package com.padsurveysystem;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.database.Cursor;
import android.graphics.Color;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.ZoomControls;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
//测量点操作类
public class StakingoutLineActivity extends Activity implements
SensorEventListener {
// 菜单视图控件
Button btnEnter;
RadioButton rbtGrid;
RadioButton rbtLatlon;
RadioButton rbtNoMap;
RadioButton rbtGoogleMap;
RadioButton rbtAnotherMap;
// 位置视图控件
MapFragment mapView;
Button btnSave;
GoogleMap googleMap;
TextView tvStation;
TextView tvOffset;
TextView tvS;
TextView tvD;
// 定义显示指南针的图片
ImageView CompassImage;
// 记录指南针图片转过的角度
float currentDegree = 0;
// 定义真机的Sensor管理器
SensorManager mSensorManager;
// GPS位置服务
LocationManager locationManager;
double Latitude = 0;
double Longitude = 0;
double Altitude = 0;
double Direction = 0;// 方向
double Speed = 0;// 速度
// 显示第三方地图
MapTilesView ivMapView;
ZoomControls zooMap;
ImageButton imbLocation;
boolean mFreshAnotherMap = true;// 当前位置设置在第三方地图的中心
boolean mHaveLocation = false;// 是否有获取位置信息
double mX = 0;
double mY = 0;
double targetX, targetY;
double currentX, currentY;
View viewSelectLine;
View viewNormal;
View viewGoogleMap;
View viewAnotherMap;
int currentView = 0;// 当前显示视图0-普通,1-googlemap,2-anothermap
boolean isShowSetView = false;// 是否显示了设置视图
String StartPointName;
String EndPointName;
String StartStation;
LinePoint StartPoint;
LinePoint EndPoint;
double drawLineStartLat;
double drawLineStartLon;
double drawLineEndLat;
double drawLineEndLon;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// instance=SurveyPositionNormalActivity.this;
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
viewNormal = (View) inflater.inflate(
R.layout.view_survey_stakingoutline_normal, null);
viewGoogleMap = (View) inflater.inflate(
R.layout.view_survey_stakingoutline_googlemap, null);
viewAnotherMap = (View) inflater.inflate(
R.layout.view_survey_stakingoutline_anothermap, null);
Bundle bundle = this.getIntent().getExtras();
StartPointName = bundle.getString("StartPointName");
EndPointName = bundle.getString("EndPointName");
StartStation = bundle.getString("StartStation");
setTitle("放样线 " + StartPointName + " - " + EndPointName); // 设置窗口标题栏名称
showNormalView();
// 获取真机的传感器管理服务
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
// GPS服务参数
String serviceString = Context.LOCATION_SERVICE;
locationManager = (LocationManager) getSystemService(serviceString);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
locationManager.requestLocationUpdates(provider, 1000, 0,
locationListener);
StartPoint = new LinePoint();
EndPoint = new LinePoint();
StartPoint.Name=StartPointName;
EndPoint.Name=EndPointName;
StartPoint.Station = Double.valueOf(StartStation);
Cursor sCursor = PadApplication.FindPointByName(StartPointName);
if (sCursor == null)
return;
int PointFlag = sCursor.getInt(0);
// 当原始坐标为测量的大地坐标和用户输入的原始大地坐标时
if (PointFlag == 1 || PointFlag == 2) {
CartesianCoordinatePoint pcc = new CartesianCoordinatePoint();
GeodeticCoordinatePoint pgc = new GeodeticCoordinatePoint();
pgc.Latitude = SurveyMath.DEGToRadian(sCursor.getDouble(3));
pgc.Longitude = SurveyMath.DEGToRadian(sCursor.getDouble(4));
pgc.Height = sCursor.getDouble(5);
drawLineStartLat = sCursor.getDouble(3);
drawLineStartLon = sCursor.getDouble(4);
// 当使用存在的坐标系统时,使用坐标正算
if (PadApplication.UseCoordinateTransfomation == 0) {
CoordinateTransform ct = new CoordinateTransform();
CoordinateSystem cs = PadApplication.CurrentCoordinateSystem;
ct.GeodeticToCartesian(pcc, pgc, cs);
} else// 使用坐标转换(点校正)
{
double[] dC = new double[3];
double[] dW = new double[3];
dW[0] = pgc.Latitude;
dW[1] = pgc.Longitude;
dW[2] = pgc.Height;
PadApplication.CoordinateTrans.WGS84TransCartesian(dW, dC);
pcc.X = dC[0];
pcc.Y = dC[1];
pcc.H = dC[2];
}
StartPoint.X = pcc.X;
StartPoint.Y = pcc.Y;
}
// 当原始坐标为用户输入的原始网格坐标和计算的交点时
if (PointFlag == 3 || PointFlag == 4) {
// 坐标反算
StartPoint.X = sCursor.getDouble(3);
StartPoint.Y = sCursor.getDouble(4);
// // 坐标反算,求出经纬度,在GOOGLEMAP上画出来
CartesianCoordinatePoint pcc = new CartesianCoordinatePoint();
GeodeticCoordinatePoint pcg = new GeodeticCoordinatePoint();
pcc.X = sCursor.getDouble(3);
pcc.Y = sCursor.getDouble(4);
pcc.H = sCursor.getDouble(5);
// 当使用存大的坐标系统时,使用坐标反算
if (PadApplication.UseCoordinateTransfomation == 0) {
CoordinateTransform ct = new CoordinateTransform();
CoordinateSystem cs = PadApplication.CurrentCoordinateSystem;
ct.CartesianToGeodetic(pcg, pcc, cs);
} else// 使用坐标转换(点校正)
{
double[] dC = new double[3];
double[] dW = new double[3];
dC[0] = pcc.X;
dC[1] = pcc.Y;
dC[2] = pcc.H;
PadApplication.CoordinateTrans.CartesianTransWGS84(dC, dW);
pcg.Latitude = dW[0];
pcg.Longitude = dW[1];
pcg.Height = dW[2];
}
SurveyAngle saLat = new SurveyAngle(pcg.Latitude);
SurveyAngle saLon = new SurveyAngle(pcg.Longitude);
drawLineStartLat = saLat.GetDEG();
drawLineStartLon = saLon.GetDEG();
}
Cursor eCursor = PadApplication.FindPointByName(EndPointName);
if (eCursor == null)
return;
PointFlag = eCursor.getInt(0);
// 当原始坐标为测量的大地坐标和用户输入的原始大地坐标时
if (PointFlag == 1 || PointFlag == 2) {
CartesianCoordinatePoint pcc = new CartesianCoordinatePoint();
GeodeticCoordinatePoint pgc = new GeodeticCoordinatePoint();
pgc.Latitude = SurveyMath.DEGToRadian(eCursor.getDouble(3));
pgc.Longitude = SurveyMath.DEGToRadian(eCursor.getDouble(4));
pgc.Height = eCursor.getDouble(5);
drawLineEndLat = eCursor.getDouble(3);
drawLineEndLon = eCursor.getDouble(4);
// 当使用存在的坐标系统时,使用坐标正算
if (PadApplication.UseCoordinateTransfomation == 0) {
CoordinateTransform ct = new CoordinateTr
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论





























收起资源包目录





































































































共 144 条
- 1
- 2
资源评论


gaoxu666666
- 粉丝: 655
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 安全用电施工方案.doc
- [最新]建设项目设计阶段工程造价控制精讲讲义.ppt
- 新村建设项目装修工程三标段.doc
- 玻璃幕墙工程的质量控制.doc
- 2020年网络广告的选择论文.doc
- 机电PLC课程方案格式及要求.doc
- 厦门大学校园无线网络招标文件.doc
- 中压燃气管道施工技术要求.doc
- nissan-的现场管理.doc
- 心电图读图大赛(003).ppt
- 质量服务清洁QSC.pptx
- 幼儿园中班科学教案:幼儿科幻画.doc
- [江苏]高层住宅楼工程混凝土专项施工方案.doc
- 【精品课件】新外研版选择性必修三UNIT1FACEVALUESDEVELOPINGIDEAS课件.ppt
- 武汉某汽车公司研发中心混凝土工程作业指导书.doc
- 整道施工工艺流程图.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
