今天,给大家分享一个小博自主开发的测量计算器App,该App有【坐标方位角正反算】、【空间坐标转换】、【四参数计算】、【七参数计算】以及【地图图幅换算】五大功能模块,顺便给大家附上该App的下载链接:点击打开链接
ps:小博只是菜鸟一枚,希望大家多多支持啦!如果有哪位朋友对这程序感兴趣的可以联系小博要该程序的源文件哦!为了方便大家在测绘技术上的交流,小博创建了一个QQ群,欢迎大家加入测绘技术交流QQ群234035436
下面附上该程序的主要代码:
1.主页
效果图:
xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.android.test.test.MainActivity">
<RelativeLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="测量计算器"
android:gravity="center"
android:layout_centerInParent="true"
android:textSize="@dimen/Theme_Text"
android:textColor="@color/colorThemeText" />
</RelativeLayout>
<LinearLayout
android:id="@+id/row1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top"
android:paddingTop="@dimen/menu_padding"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/menu1"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/angle"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu1_name"/>
</LinearLayout>
<LinearLayout
android:id="@+id/menu2"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/earth" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu2_name"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/row2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/menu_padding"
android:orientation="horizontal"
android:layout_below="@+id/row1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:id="@+id/menu3"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/fpara"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu3_name"/>
</LinearLayout>
<LinearLayout
android:id="@+id/menu4"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/spara" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu4_name"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/row3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/row2"
android:paddingTop="@dimen/menu_padding"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/menu5"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/map"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu5_name"/>
</LinearLayout>
<LinearLayout
android:id="@+id/menu6"
android:layout_width="0dp"
android:layout_height="@dimen/menu_height"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:src="@drawable/help"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/menu_text"
android:text="@string/menu6_name"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
MainActivity.java:
package com.android.test.test;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class MainActivity extends AppCompatActivity {
private LinearLayout menu1,menu2,menu3,menu4,menu5,menu6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initEvent();
menu1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,ZuoBiaoZhengFan.class);
startActivity(intent);
}
});
menu2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,ZuoBiaoChange.class);
startActivity(intent);
}
});
menu3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,FourPara.class);
startActivity(intent);
}
});
menu4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,SevenPara.class);
startActivity(intent);
}
});
menu5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,MapLacationCacul.class);
startActivity(intent);
}
});
menu6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,AtivityHelp.class);
startActivity(intent);
}
});
}
private void initEvent()
{
menu1=(LinearLayout)findViewById(R.id.menu1);
menu2=(LinearLayout)findViewById(R.id.menu2);
menu3=(LinearLayout)findViewById(R.id.menu3);
menu4=(LinearLayout)findViewById(R.id.menu4);
menu5=(LinearLayout)findViewById(R.id.menu5);
menu6=(LinearLayout)findViewById(R.id.menu6);
}
}
2.坐标方位角正反算功能模块
计算界面效果图:
xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground">
<RelativeLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="坐标正反算"
android:gravity="center"
android:layout_centerInParent="true"
android:textSize="@dimen/Theme_Text"
android:textColor="@color/colorThemeText" />
<ImageView
android:id="@+id/back"
android:layout_width="25dp"
android:layout_height="match_parent"
android:src="@drawable/back"
android:layout_marginLeft="@dimen/margin_left"/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/top">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioGroup
android:id="@+id/radGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="@dimen/margin_left"
android:layout_marginLeft="@dimen/margin_left"
android:layout_marginRight="@dimen/margin_left"
android:orientation="horizontal"
android:background="@drawable/view_bg">
<RadioButton
android:id="@+id/rad_zheng"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="80dp"
android:checked="true"
android:text="正算" />
<RadioButton
android:id="@+id/rad_fang"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="反算" />
</RadioGroup>
<!--起始点坐标-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_left"
android:layout_marginLeft="@dimen/margin_left"
android:layout_marginRight="@dimen/margin_left"
android:layout_marginTop="@dimen/margin_left"
android:background="@drawable/view_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="X1"/>
<EditText
android:id="@+id/et_X1"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="起始点横坐标"
android:background="@drawable/edit_bg"
android:inputType="numberSigned|numberDecimal"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_left"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="Y1"/>
<EditText
android:id="@+id/et_Y1"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="起始点纵坐标"
android:background="@drawable/edit_bg"
android:inputType="numberSigned|numberDecimal"/>
</LinearLayout>
</LinearLayout>
<!--终点坐标-->
<LinearLayout
android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_left"
android:layout_marginLeft="@dimen/margin_left"
android:layout_marginRight="@dimen/margin_left"
android:layout_marginTop="@dimen/margin_left"
android:background="@drawable/view_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="X2"/>
<EditText
android:id="@+id/et_X2"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="终止点横坐标"
android:background="@drawable/edit_bg"
android:inputType="numberSigned|numberDecimal"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_left"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="Y2"/>
<EditText
android:id="@+id/et_Y2"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="终止点纵坐标"
android:background="@drawable/edit_bg"
android:inputType="numberSigned|numberDecimal"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_left"
android:layout_marginLeft="@dimen/margin_left"
android:layout_marginRight="@dimen/margin_left"
android:layout_marginTop="@dimen/margin_left"
android:background="@drawable/view_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="方位角"/>
<EditText
android:id="@+id/et_Angle"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="坐标方位角"
android:background="@drawable/edit_bg"
android:inputType="numberDecimal"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_left"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:textSize="@dimen/edit_text"
android:textColor="@color/colorPrimary"
android:text="距离"/>
<EditText
android:id="@+id/et_S"
android:layout_width="0dp"
android:layout_height="@dimen/edit_height"
android:layout_weight="7"
android:hint="起始点到终止点的距离"
android:background="@drawable/edit_bg"
android:inputType="numberSigned|numberDecimal"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_left"
android:orientation="horizontal">
<Button
android:id="@+id/btn_cacu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:layout_marginLeft="@dimen/margin_left"
android:text="计算"
android:textColor="#ffffff"
android:background="@drawable/btn_bg"/>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Button
android:id="@+id/btn_back"
android:layout_width="0dp"
android:layout_height="