Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions README.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# UCMapViewer —— A General Map Framework Based on UCMap

# I. Effects

## Project List

![Project](readme/1.png)

## Online Base Map

![Online Base Map](readme/17.jpg)

## Layer Control

![Layer Management](readme/2.png)

## Image Transparency

![Image Transparency](readme/3.png)

## Vector Rendering Style Settings

![Vector Rendering Style Settings](readme/4.png)

## Vector Rendering Style Settings

![Interactive Query](readme/5.png)

## Fuzzy Query

![Fuzzy Query](readme/6.png)

## Distance Measurement

![Distance Measurement](readme/7.png)

## Area Measurement

![Area Measurement](readme/8.png)

## Feature Editing

![Feature Editing](readme/9.png)

## Precise Geometry Editing

![Precise Geometry Editing](readme/10.png)

## Create Vector Layer

![Precise Geometry Editing](readme/11.png)


## Element Attribute Editing

![Element Attribute Editing](readme/12.png)

## Compass, Scale, GPS Status Information

![Compass, Scale, GPS Status Information](readme/13.png)

## General Map Operations (Zoom In, Zoom Out, Full Map, Drag, Tilt, Rotate)

![General Map Operations](readme/14.png)

## Tracks

![Tracks](readme/15.png)
![Tracks](readme/16.jpg)

## Data Sources

- `Google` WMTS map service (Online)
- `Tianditu` WMTS (Online)
- `OGC WMTS`
- `OGC WFS`
- `ArcGIS Server`
- `MBTiles`
- `GeoJson`
- `GeoTiff`, `tiff`, `png`
- `ESRI Shapefile`
- `GPX`

# II. How to Use

1. Download `UCMapViewer.apk` from the `Release` directory and install it on your phone or tablet.
2. Download the `示例` (Example) data from the `readme` directory and copy it to the `UCMapViewer\Projects` directory in the root of the SD card.
3. Launch the App.
4. Start creating your own custom data.

# III. How to Develop

1. Download the source code; the project source code needs to be compiled using Android Studio.
2. The code encoding is `utf-8`. If Chinese comments appear garbled, please switch the editor's encoding format.
3. The project references two external projects on jcenter; please ensure a stable network connection during compilation.

# IV. Source Code Structure

* `FrameWork` —— Framework
* `Config` —— Configuration related
* `EventBus` —— Event Bus
* `MapModule` —— Map Module
* `ProjectsModule` —— Project List Module
* `RootAct` —— Application Startup Page
* `GloabApp` —— Application Global

# V. Extension

## 1. Create a Custom Module Class

Create a `HelloWorld.java` file in the `Widgets` directory and add the following content:

```java
public class HelloWorld extends BaseModule {

public View mWidgetView = null;//
/**
* Operation to be performed when the component panel is opened.
* When the widget button is clicked, WidgetManager will call this method for the panel's open logic.
* The "inactive" method will be called when the panel is closed.
*/
@Override
public void active() {

super.active();// Default call is required to ensure that when switching to other widgets, this widget can correctly execute the inactive() method and close.
super.showWidget(mWidgetView);// Load UI and display
super.showMessageBox(super.name);// Display component name

}

/**
* Initialization operation of the widget component, including setting view content, logic, etc.
* This method is executed after the application has finished loading.
*/
@Override
public void create() {
LayoutInflater mLayoutInflater = LayoutInflater.from(super.context);
// Set widget component display content
mWidgetView = mLayoutInflater.inflate(R.layout.widget_view_helloworld,null);

}

/**
* Operation to be performed when the component panel is closed.
* The "inactive" method will be called when the panel is closed.
*/
@Override
public void inactive(){
super.inactive();
}

}
```

## 2. Design Layout XML

## 3. Add Corresponding Content to Configuration File

Add the following content under `assets/config.xml`:
```xml
<module label="Test" classname="com.node.ucmapviewer.Moodules.HelloWorld" config=""/>
```

## 4. Operating the Mapview Object in a Module

Each Module extends the parent class `BaseModule`. Use the following method to obtain and operate on the contents of the mapview object:
```java
MapView mapview = super.mapView;

```

## 5. Communication Between Widgets

Communication between Modules is implemented by introducing EventBus 3.0. Basic usage is as follows:

### Subscribe
```java
EventBus.getDefault().register(this);// Subscribe
```
### Unsubscribe
```java
EventBus.getDefault().unregister(this);// Unsubscribe
```

### Publish Event
```java
EventBus.getDefault().post(new MessageEvent("Event Description"));
```

### Event Handling
```java
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDataSynEvent(MessageEvent event) {
Log.e(TAG, "event---->" + event.getMessage());
// Execute different methods based on the message content
}
```

# VI. Project Files

UCMapViewer manages data based on project folders, all of which are located under the system root directory `/UCMapViewer/Projects`.
Each project has a project index file, e.g., `XXXProject/xxxProject.json`.
```
{
"layers": [
{
"name": "Tianditu Image",
"type": "mbtiles",
"path": "world.mbtiles",
"layerIndex": 1,
"visible": true,
"minlevel":0,
"maxlevel":18,
"ahpla":0.9
},
{
"name": "National County-level Administrative Area",
"type": "shapefile",
"path": "all.shp",
"layerIndex": 4,
"visible": false,
"editable":true,
"queryable":true
"style":{
"lineWidth":2,
"lineColor":"#ffff0000",
"fillColor":"#ff00fc00"
}
}
]
}
```
Note: `type` supports the following two types:

* `mbtiles` - Tile data in mbtiles format
* `shapefile` - Vector data in ESRI Shapefile format