1.前言
在工程测量或者GPS定位测量等测量工作中,经常会涉及到不同坐标系统之间的转换计算问题,而这些坐标系统的转换运算涉及到复杂的数学模型和天文数字,仅凭人工手算不仅计算量大而且可靠性也不高。目前,虽然已经有许多电脑软件比如AcrGIS软件等,都能轻松实现不同测量坐标系统之间的换算,但是,在实际的测量工作中,相对于轻巧的智能手机来说,带着一台笔记本去测量是十分不方便的,所以,开发一个能够实现坐标换算的安卓APP就十分有必要了。由于时间关系,本人简单仅做了能实现在相同参考椭球条件下的直角坐标系与大地坐标系之间转换的App,以下是该App的详细设计及其代码。希望大家多多支持,多多关注,后面还会陆陆续续写一些与工程测量领域有关的App,欢迎大家加入测绘技术交流QQ群234035436。
2.App最终成果图
3.App整体界面设计结构
xml文件:
对于一个APP来说,除了代码简洁外,界面的设计也是非常重要的,友好简洁的操作界面能给人带来更好的体验,以下是整体操作界面框架的结构
不啰嗦,小博直接附上各个界面详细设计及其各控件的主要xml代码
4.启动app时初始化界面(welcome.xml)
附上welcome.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/welcome"/>
</LinearLayout>
附上程序初始化执行的Welcome.java代码:
import java.util.Timer;
import java.util.TimerTask;
public class Welcome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
final Intent main_ativity=new Intent(this,MainActivity.class);
Timer timer=new Timer();
TimerTask task=new TimerTask() {
@Override
public void run() {
startActivity(main_ativity);
}
};
timer.schedule(task,1000*3);
}
}
5.主界面(activity_main.xml)
主页标题栏TextView控件主要xml代码(从activity_main.xml文件中提取部分):
<TextView
android:id="@+id/tv_theme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text=""
android:textStyle="bold"
android:textSize="28dp"
android:gravity="center"
android:textColor="#ffffff"/>
主页ViewPager控件主要xml代码(从activity_main.xml文件中提取部分):
<android.support.v4.view.ViewPager
android:id="@+id/vp_content"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="0dp"
android:layout_weight="1" >
</android.support.v4.view.ViewPager>
主页底部菜单栏主要xml代码(从
activity_main.xml文件中提取部分):
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_parameter"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/Image_para"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/earth_para0" />
<TextView
android:id="@+id/tv_parameter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="椭球"
android:textColor="@color/colorUnSelectedMenu"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_calculate"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/Image_calculate"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/image_calculate0" />
<TextView
android:id="@+id/tv_calculate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="计算"
android:textColor="@color/colorUnSelectedMenu"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_about"