-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: Added base implementation for the Survey3D object
- Loading branch information
1 parent
1dd6593
commit 8cc3b18
Showing
5 changed files
with
294 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
style="@style/missionItemDetailLayout" > | ||
|
||
<org.droidplanner.android.widgets.spinners.SpinnerSelfSelect | ||
android:id="@+id/spinnerWaypointType" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentTop="true" | ||
android:layout_margin="5dp" | ||
android:entries="@array/ExampleWaypointType" /> | ||
|
||
<RelativeLayout | ||
android:id="@+id/title_rect" | ||
android:layout_width="match_parent" | ||
android:layout_height="64dp" | ||
android:layout_alignParentTop="true" | ||
android:background="@drawable/wp_title_rectangle" > | ||
|
||
<TextView | ||
android:id="@+id/WaypointIndex" | ||
style="@style/largeMissionDetailText" | ||
android:layout_width="64dp" | ||
android:layout_height="wrap_content" | ||
android:layout_centerVertical="true" | ||
tools:text="22" /> | ||
|
||
<View | ||
android:id="@+id/title_div" | ||
android:layout_width="1dp" | ||
android:layout_height="54dp" | ||
android:layout_alignParentTop="true" | ||
android:layout_marginTop="5dp" | ||
android:layout_toRightOf="@id/WaypointIndex" | ||
android:background="@drawable/wp_title_div" /> | ||
|
||
<RelativeLayout | ||
android:id="@+id/title_content" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_centerVertical="true" | ||
android:layout_toRightOf="@id/title_div" | ||
android:orientation="vertical" > | ||
|
||
<TextView | ||
android:id="@+id/WaypointType" | ||
style="@style/missionHeaderTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="12dp" | ||
android:text="@string/waypointType_BuildingMapper" | ||
android:textAllCaps="true" /> | ||
|
||
<TextView | ||
android:id="@+id/DistanceLabel" | ||
style="@style/missionHeaderlabel" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignLeft="@id/WaypointType" | ||
android:layout_below="@id/WaypointType" | ||
android:text="@string/distance_to_home" /> | ||
|
||
<TextView | ||
android:id="@+id/DistanceValue" | ||
style="@style/missionHeaderValue" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBaseline="@id/DistanceLabel" | ||
android:layout_marginLeft="12dp" | ||
android:layout_toRightOf="@id/DistanceLabel" | ||
tools:text="20m" /> | ||
</RelativeLayout> | ||
</RelativeLayout> | ||
|
||
<ImageView | ||
android:id="@+id/menuHint" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBottom="@id/title_rect" | ||
android:layout_alignParentRight="true" | ||
android:layout_margin="10dp" | ||
android:src="@drawable/ic_menu_hint" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/title_rect" > | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" > | ||
|
||
<TextView | ||
style="@style/ModeDetailText" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/mode_desc_rectangle" | ||
android:text="Map a building" /> | ||
|
||
<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView | ||
android:id="@+id/radiusPicker" | ||
style="@style/missionItemDetailCard" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/circle_radius" /> | ||
|
||
<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView | ||
android:id="@+id/startAltitudePicker" | ||
style="@style/missionItemDetailCard" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Start altitude" /> | ||
|
||
<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView | ||
android:id="@+id/heightStepPicker" | ||
style="@style/missionItemDetailCard" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Step height" /> | ||
|
||
<org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView | ||
android:id="@+id/stepsPicker" | ||
style="@style/missionItemDetailCard" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Number of steps" /> | ||
|
||
<CheckBox | ||
android:id="@+id/checkBoxSurveyCrossHatch" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="8dp" | ||
android:fontFamily="sans-serif-light" | ||
android:padding="5dp" | ||
android:text="Cross Hatch" | ||
android:textSize="20sp" /> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" > | ||
|
||
<TextView | ||
android:id="@+id/staticText" | ||
style="@style/ModeDetailText" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="left" | ||
android:text="@string/camera_" | ||
android:textAppearance="?android:attr/textAppearanceMedium" /> | ||
|
||
<org.droidplanner.android.widgets.spinners.SpinnerSelfSelect | ||
android:id="@+id/cameraFileSpinner" | ||
android:layout_width="196dp" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBottom="@id/staticText" | ||
android:layout_alignParentRight="true" | ||
android:layout_alignTop="@id/staticText" | ||
android:layout_gravity="center" | ||
android:layout_toRightOf="@id/staticText" | ||
android:entries="@array/ExampleCameraArray" /> | ||
</RelativeLayout> | ||
|
||
</LinearLayout> | ||
</ScrollView> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...id/src/org/droidplanner/android/proxy/mission/item/fragments/MissionSurvey3DFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package org.droidplanner.android.proxy.mission.item.fragments; | ||
|
||
import java.util.List; | ||
|
||
import org.droidplanner.R; | ||
import org.droidplanner.R.id; | ||
import org.droidplanner.android.proxy.mission.item.adapters.CamerasAdapter; | ||
import org.droidplanner.android.widgets.spinnerWheel.CardWheelHorizontalView; | ||
import org.droidplanner.android.widgets.spinnerWheel.adapters.NumericWheelAdapter; | ||
import org.droidplanner.android.widgets.spinners.SpinnerSelfSelect; | ||
import org.droidplanner.core.mission.MissionItemType; | ||
import org.droidplanner.core.mission.survey.Survey3D; | ||
import org.droidplanner.core.survey.CameraInfo; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.CheckBox; | ||
import android.widget.CompoundButton; | ||
import android.widget.Spinner; | ||
|
||
public class MissionSurvey3DFragment extends MissionDetailFragment implements | ||
CardWheelHorizontalView.OnCardWheelChangedListener, CompoundButton.OnCheckedChangeListener { | ||
|
||
private CheckBox checkBoxAdvanced; | ||
private CardWheelHorizontalView startAltitudeStepPicker, stepHeightStepPicker; | ||
private SpinnerSelfSelect cameraSpinner; | ||
private CamerasAdapter cameraAdapter; | ||
private List<Survey3D> missionItems; | ||
|
||
@Override | ||
protected int getResource() { | ||
return R.layout.fragment_editor_detail_survey3d; | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
final Context context = getActivity().getApplicationContext(); | ||
|
||
Log.d("DEBUG", "onViewCreated"); | ||
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.SURVEY3D)); | ||
|
||
missionItems = (List<Survey3D>) getMissionItems(); | ||
// Use the first one as reference. | ||
final Survey3D firstItem = missionItems.get(0); | ||
|
||
cameraAdapter = new CamerasAdapter(getActivity(), | ||
android.R.layout.simple_spinner_dropdown_item); | ||
cameraSpinner = (SpinnerSelfSelect) view.findViewById(id.cameraFileSpinner); | ||
cameraSpinner.setAdapter(cameraAdapter); | ||
cameraSpinner.setOnSpinnerItemSelectedListener(this); | ||
cameraAdapter.setTitle(firstItem.getCamera().name); | ||
|
||
startAltitudeStepPicker = (CardWheelHorizontalView) view | ||
.findViewById(R.id.startAltitudePicker); | ||
startAltitudeStepPicker.setViewAdapter(new NumericWheelAdapter(context, | ||
R.layout.wheel_text_centered, MIN_ALTITUDE, MAX_ALTITUDE, "%d m")); | ||
startAltitudeStepPicker.addChangingListener(this); | ||
//startAltitudeStepPicker.setCurrentValue((int) firstItem.getCoordinate().getAltitude().valueInMeters()); | ||
|
||
stepHeightStepPicker = (CardWheelHorizontalView) view.findViewById(R.id.heightStepPicker); | ||
stepHeightStepPicker.setViewAdapter(new NumericWheelAdapter(context, | ||
R.layout.wheel_text_centered, 1, MAX_ALTITUDE, "%d m")); | ||
stepHeightStepPicker.addChangingListener(this); | ||
//stepHeightStepPicker.setCurrentValue((int) firstItem.getEndAltitude().valueInMeters()); | ||
|
||
checkBoxAdvanced = (CheckBox) view.findViewById(R.id.checkBoxSurveyCrossHatch); | ||
checkBoxAdvanced.setOnCheckedChangeListener(this); | ||
//checkBoxAdvanced.setChecked(firstItem.isCrossHatchEnabled()); | ||
|
||
} | ||
|
||
@Override | ||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | ||
//getItem().enableCrossHatch(isChecked); | ||
getMissionProxy().getMission().notifyMissionUpdate(); | ||
} | ||
|
||
@Override | ||
public void onChanged(CardWheelHorizontalView cardWheel, int oldValue, int newValue) { | ||
switch (cardWheel.getId()) { | ||
case R.id.startAltitudePicker: | ||
//getItem().setAltitude(new Altitude(newValue)); | ||
break; | ||
case R.id.heightStepPicker: | ||
//getItem().setAltitudeStep(newValue); | ||
break; | ||
} | ||
getMissionProxy().getMission().notifyMissionUpdate(); | ||
} | ||
|
||
@Override | ||
public void onSpinnerItemSelected(Spinner spinner, int position) { | ||
if (spinner.getId() == id.cameraFileSpinner) { | ||
CameraInfo cameraInfo = cameraAdapter.getCamera(position); | ||
cameraAdapter.setTitle(cameraInfo.name); | ||
for (Survey3D scan : missionItems) { | ||
scan.setCameraInfo(cameraInfo); | ||
} | ||
getMissionProxy().getMission().notifyMissionUpdate(); | ||
} | ||
} | ||
|
||
private Survey3D getItem() { | ||
Survey3D cylindricalSurvey = (Survey3D) getMissionItems().get(0); | ||
return cylindricalSurvey; | ||
} | ||
} |