Skip to content

Commit f24818d

Browse files
committed
Added some data/vpf vmaplv0 configuration files with more instructions
on how to use the VPFFeatureLayer. Fixed the VPF attribute fetching with proper indexes. The VPF package api changed in some deep methods, to allow the proper feature id to be passed to the place where it's needed to fetch attributes. Added intersets method to DataBounds. Can be tested with new BoundsTestLayer in layer.test package.
1 parent c04974f commit f24818d

17 files changed

+2418
-2238
lines changed

CHANGELOG

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
2013-02-28 dietrick <[email protected]>
22

3+
* Added some data/vpf vmaplv0 configuration files with more
4+
instructions on how to use the VPFFeatureLayer.
5+
6+
* Fixed the VPF attribute fetching with proper indexes. The VPF
7+
package api changed in a deep section, to allow the proper feature
8+
id to be passed to the place where it's needed to fetch
9+
attributes.
10+
11+
* Added intersets method to DataBounds. Can be tested with new
12+
BoundsTestLayer in layer.test package.
13+
314
* Updated SwingWorker and PooledSwingWorker to use FutureTask
415
objects, reducing the number of threads that are created. Updated
516
OMGraphicHandlerLayer.workerComplete to take a ISwingWorker in its

share/data/vpf/README

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
This directory contains information that is used by the
2+
VPFFeatureLayer and the VPFAutoFeatureGraphicWarehouse. The
3+
symbol-lookup files are summaries of the MIL-PRF-89045 GeoSym standard
4+
contents, that tie FACC codes, with certain parameter conditions, to
5+
GeoSym symbol numbers.
6+
7+
The dcw versions are pretty complete. The vmaplv0 version is not at
8+
all, but they contain a sample for inland water that should get you
9+
started. You'll need a copy of the 89045 doc to figure out the symbol
10+
types you want to display. The VPFFeatureLayer uses the geosym cgm
11+
files, you'll have to track those down (I'm not sure of the
12+
releaseability).
13+
14+
15+
The properties for a layer that uses these files are here:
16+
vpf_water.class=com.bbn.openmap.layer.vpf.VPFFeatureLayer
17+
vpf_water.prettyName=VMAPLV0 Inland Water
18+
vpf_water.vpfPath=/Volumes/data/vpf/vmaplv0/v0noa/vmaplv0
19+
# VFPAutoFeatureGraphicWarehouse options:
20+
vpf_water.cgmDirectory=data/geosym/cgm/
21+
vpf_water.faccLookupFile=data/vpf/vmaplv0-symbol-lookup.csv
22+
# The priority file is the file to adjust to customize display...
23+
vpf_water.priorityFile=data/vpf/vmaplv0-priority-iw.csv
24+
vpf_water.featureInfoHandler=com.bbn.openmap.layer.vpf.TTFeatureInfoHandler
25+
26+
The order of how different features are laid out are specified in the
27+
priority file, and feature rendering is determined by the cgm files.
28+
29+
Using this layer can be slower than the standard VPFLayer, especially
30+
with a lot of FACC codes being rendered. I recommend that you
31+
configure the layer, and then use it to make map image tiles with the
32+
com.bbn.openmap.dataAccess.mapTile.MapTileMaker. You can then use the
33+
tiles in the map using the com.bbn.openmap.layer.image.MapTileLayer.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
priority,type,facc,conditions,description
2+
2,Line,BH000,,
3+
2,Area,BH000,,
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
facc,type,symbol,conditions,size,xoff,yoff
2+
BH000,L,0621,,,,
3+
BH000,A,4152,,,,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package com.bbn.openmap.layer.test;
2+
3+
import com.bbn.openmap.layer.OMGraphicHandlerLayer;
4+
import com.bbn.openmap.omGraphics.OMAction;
5+
import com.bbn.openmap.omGraphics.OMColor;
6+
import com.bbn.openmap.omGraphics.OMGraphic;
7+
import com.bbn.openmap.omGraphics.OMGraphicList;
8+
import com.bbn.openmap.omGraphics.OMRect;
9+
import com.bbn.openmap.tools.drawing.DrawingToolRequestor;
10+
import com.bbn.openmap.tools.drawing.OMDrawingTool;
11+
import com.bbn.openmap.util.DataBounds;
12+
13+
/**
14+
* A little layer to test out the DataBounds intersections. You draw OMRects
15+
* using the drawing tool, and any rectangles that overlap fill up with red.
16+
*
17+
* @author dietrick
18+
*/
19+
public class BoundsTestLayer extends OMGraphicHandlerLayer implements DrawingToolRequestor {
20+
21+
OMGraphicList holder = new OMGraphicList();
22+
OMDrawingTool drawingTool = null;
23+
String BOUNDS = "bounds";
24+
String HIT = "hit";
25+
26+
public BoundsTestLayer() {
27+
setMouseModeIDsForEvents(new String[] { "Gestures" });
28+
}
29+
30+
public OMGraphicList prepare() {
31+
32+
OMGraphicList list = new OMGraphicList();
33+
list.addAll(holder);
34+
35+
for (OMGraphic omg : holder) {
36+
omg.removeAttribute(HIT);
37+
omg.setFillPaint(OMColor.clear);
38+
}
39+
40+
for (OMGraphic omg : holder) {
41+
if (omg instanceof OMRect) {
42+
DataBounds bnds = (DataBounds) omg.getAttribute(BOUNDS);
43+
44+
for (OMGraphic omg2 : list) {
45+
if (omg2 instanceof OMRect && !omg.equals(omg2)) {
46+
DataBounds bnds2 = (DataBounds) omg2.getAttribute(BOUNDS);
47+
48+
if (bnds.intersects(bnds2)) {
49+
omg.putAttribute(HIT, true);
50+
omg2.putAttribute(HIT, true);
51+
}
52+
}
53+
}
54+
}
55+
}
56+
57+
for (OMGraphic omg : holder) {
58+
if (omg.getAttribute(HIT) != null) {
59+
omg.setFillPaint(OMColor.red);
60+
}
61+
}
62+
63+
list.generate(getProjection());
64+
return list;
65+
}
66+
67+
public void findAndInit(Object obj) {
68+
super.findAndInit(obj);
69+
70+
if (obj instanceof OMDrawingTool) {
71+
drawingTool = (OMDrawingTool) obj;
72+
}
73+
}
74+
75+
public boolean isSelectable(OMGraphic omg) {
76+
return (drawingTool != null && drawingTool.canEdit(omg.getClass()));
77+
}
78+
79+
/**
80+
* Called if isSelectable(OMGraphic) was true, so the list has the
81+
* OMGraphic. A list is used in case underlying code is written to handle
82+
* more than one OMGraphic being selected at a time.
83+
*/
84+
public void select(OMGraphicList list) {
85+
if (list != null && !list.isEmpty()) {
86+
OMGraphic omg = list.getOMGraphicAt(0);
87+
88+
if (drawingTool != null && drawingTool.canEdit(omg.getClass())) {
89+
drawingTool.setBehaviorMask(OMDrawingTool.QUICK_CHANGE_BEHAVIOR_MASK);
90+
if (drawingTool.edit(omg, this) == null) {
91+
// Shouldn't see this because we checked, but ...
92+
fireRequestInfoLine("Can't figure out how to modify this object.");
93+
}
94+
}
95+
}
96+
}
97+
98+
/*
99+
* (non-Javadoc)
100+
*
101+
* @see
102+
* com.bbn.openmap.tools.drawing.DrawingToolRequestor#drawingComplete(com
103+
* .bbn.openmap.omGraphics.OMGraphic, com.bbn.openmap.omGraphics.OMAction)
104+
*/
105+
public void drawingComplete(OMGraphic omg, OMAction action) {
106+
if (omg instanceof OMRect) {
107+
OMRect rect = (OMRect) omg;
108+
DataBounds bounds = new DataBounds(rect.getWestLon(), rect.getNorthLat(), rect.getEastLon(), rect.getSouthLat());
109+
rect.putAttribute(BOUNDS, bounds);
110+
}
111+
holder.doAction(omg, action);
112+
doPrepare();
113+
}
114+
}

0 commit comments

Comments
 (0)