本文整理汇总了Java中org.geotools.styling.UserLayer类的典型用法代码示例。如果您正苦于以下问题:Java UserLayer类的具体用法?Java UserLayer怎么用?Java UserLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserLayer类属于org.geotools.styling包,在下文中一共展示了UserLayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: undoAction
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Undo action.
*
* @param undoRedoObject the undo/redo object
*/
@Override
public void undoAction(UndoInterface undoRedoObject) {
if (undoRedoObject != null) {
if (undoRedoObject.getOldValue() instanceof String) {
String oldValue = (String) undoRedoObject.getOldValue();
UserLayer userLayer = DefaultSymbols.createNewUserLayer();
InlineFeatureUtils.setInlineFeatures(userLayer, oldValue);
if (inlineGML != null) {
inlineGML.setInlineFeatures(oldValue);
}
if (inlineFeature != null) {
inlineFeature.setInlineFeatures(userLayer);
}
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FieldConfigInlineFeature.java
示例2: redoAction
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Redo action.
*
* @param undoRedoObject the undo/redo object
*/
@Override
public void redoAction(UndoInterface undoRedoObject) {
if (undoRedoObject != null) {
if (undoRedoObject.getNewValue() instanceof String) {
String newValue = (String) undoRedoObject.getNewValue();
UserLayer userLayer = DefaultSymbols.createNewUserLayer();
InlineFeatureUtils.setInlineFeatures(userLayer, newValue);
if (inlineGML != null) {
inlineGML.setInlineFeatures(newValue);
}
if (inlineFeature != null) {
inlineFeature.setInlineFeatures(userLayer);
}
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:FieldConfigInlineFeature.java
示例3: populateField
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Populate field.
*
* @param value the value
*/
@Override
public void populateField(UserLayer value) {
String inlineFeaturesText = InlineFeatureUtils.getInlineFeaturesText(value);
if (inlineGML != null) {
inlineGML.setInlineFeatures(inlineFeaturesText);
}
if (inlineFeature != null) {
inlineFeature.setInlineFeatures(value);
}
UndoManager.getInstance().addUndoEvent(
new UndoEvent(this, getFieldId(), oldValueObj, new String(inlineFeaturesText)));
oldValueObj = new String(inlineFeaturesText);
valueUpdated();
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:24,代码来源:FieldConfigInlineFeature.java
示例4: setInlineFeatures
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Sets the inline features.
*
* @param userLayer the user layer
*/
public void setInlineFeatures(UserLayer userLayer) {
if (userLayer != null) {
String crsCode = "";
SimpleFeatureType inlineFeatureType = userLayer.getInlineFeatureType();
if (inlineFeatureType != null) {
crsCode = CoordManager.getInstance()
.getCRSCode(inlineFeatureType.getCoordinateReferenceSystem());
}
setPopulating(true);
crsComboBox.setSelectValueKey(crsCode);
setPopulating(false);
model.populate(userLayer);
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:InlineFeaturePanel.java
示例5: testGetTreeString
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.tree.item.UserLayerTreeItem#getTreeString(java.lang.Object)}.
*/
@Test
public void testGetTreeString() {
UserLayerTreeItem item = new UserLayerTreeItem();
String actualValue = item.getTreeString(null, null);
String expectedValue = String.format("%s : %s",
Localisation.getString(SLDTreeTools.class, "TreeItem.userlayer"), "");
assertTrue(actualValue.compareTo(expectedValue) == 0);
UserLayer userLayer = DefaultSymbols.createNewUserLayer();
actualValue = item.getTreeString(null, userLayer);
assertTrue(actualValue.compareTo(expectedValue) == 0);
String expectedName = "test name";
userLayer.setName(expectedName);
actualValue = item.getTreeString(null, userLayer);
expectedValue = String.format("%s : %s",
Localisation.getString(SLDTreeTools.class, "TreeItem.userlayer"), expectedName);
assertTrue(actualValue.compareTo(expectedValue) == 0);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:UserLayerTreeItemTest.java
示例6: testSLDTreeTools
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.tree.SLDTreeTools#SLDTreeTools(com.sldeditor.ui.tree.UpdateTreeStructureInterface, javax.swing.JTree, java.util.List)}.
*/
@Test
public void testSLDTreeTools() {
SLDTreeTools treeTools = new SLDTreeTools();
// Try calling public methods when constructor parameters are null
treeTools.addNewLine();
treeTools.addNewMarker();
treeTools.addNewPolygon();
treeTools.addNewText();
treeTools.addNewThing(null);
treeTools.addNewThing(UserLayer.class);
treeTools.addNewThing(NamedLayer.class);
treeTools.addNewRaster();
treeTools.addDestArrow();
treeTools.addSourceArrow();
treeTools.moveItem(true);
treeTools.removeItem();
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:23,代码来源:SLDTreeToolsTest.java
示例7: testGetValueAt
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getValueAt(int, int)}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#populate(org.geotools.styling.UserLayer)}.
*/
@Test
public void testGetValueAt() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertEquals(1, model.getRowCount());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
assertNull(model.getValueAt(-1, 0));
assertNull(model.getValueAt(5, 0));
assertNull(model.getValueAt(0, -1));
assertNull(model.getValueAt(0, 5));
String actualValue = (String) model.getValueAt(0, 1);
assertTrue(actualValue.compareTo("Pacific NW") == 0);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:InLineFeatureModelTest.java
示例8: testUpdateGeometry
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#updateGeometry(int, com.vividsolutions.jts.geom.Geometry)}.
*/
@Test
public void testUpdateGeometry() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
assertNull(model.getFeatureCollection());
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertFalse(listener.hasInlineFeatureUpdatedCalled());
model.updateGeometry(0, null);
assertTrue(listener.hasInlineFeatureUpdatedCalled());
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:InLineFeatureModelTest.java
示例9: testGetInlineFeaturesText
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.InlineFeatureUtils#getInlineFeaturesText(org.geotools.styling.UserLayer)}.
*/
@Test
public void testGetInlineFeaturesText() {
String actualResult = InlineFeatureUtils.getInlineFeaturesText(null);
assertTrue(actualResult.compareTo("") == 0);
// Test 1
SLDData sldData = new SLDData(null, testInline1a);
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
UserLayer userLayer1 = (UserLayer) sld.layers().get(0);
actualResult = InlineFeatureUtils.getInlineFeaturesText(userLayer1);
assertTrue(actualResult.startsWith("<FeatureCollection>"));
assertTrue(actualResult.endsWith("</FeatureCollection>"));
// Test 2
sldData = new SLDData(null, testInline1b);
sld = SLDUtils.createSLDFromString(sldData);
UserLayer userLayer2 = (UserLayer) sld.layers().get(0);
actualResult = InlineFeatureUtils.getInlineFeaturesText(userLayer2);
assertTrue(actualResult.startsWith("<FeatureCollection>"));
assertTrue(actualResult.endsWith("</FeatureCollection>"));
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:InlineFeatureUtilsTest.java
示例10: getUserLayerFeatureSource
import org.geotools.styling.UserLayer; //导入依赖的package包/类
@Override
// CHECKSTYLE:OFF
public Map<UserLayer, FeatureSource<SimpleFeatureType, SimpleFeature>> getUserLayerFeatureSource() {
// CHECKSTYLE:ON
Map<UserLayer, FeatureSource<SimpleFeatureType, SimpleFeature>> map = new HashMap<UserLayer, FeatureSource<SimpleFeatureType, SimpleFeature>>();
for (DataSourceInfo dsInfo : userLayerDataSourceInfo) {
FeatureSource<SimpleFeatureType, SimpleFeature> features = dsInfo.getFeatures();
UserLayer userLayer = dsInfo.getUserLayer();
map.put(userLayer, features);
}
return map;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:15,代码来源:DataSourceImpl.java
示例11: setTestValue
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Sets the test string value.
*
* @param fieldId the field id
* @param testValue the test value
*/
@Override
public void setTestValue(FieldIdEnum fieldId, String testValue) {
UserLayer userLayer = DefaultSymbols.createNewUserLayer();
InlineFeatureUtils.setInlineFeatures(userLayer, testValue);
populateField(userLayer);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:14,代码来源:FieldConfigInlineFeature.java
示例12: containsInLineFeatures
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Checks to see if SLD contains inline features.
*
* @param sld the sld
* @return true, if sld contains inline features
*/
public static boolean containsInLineFeatures(StyledLayerDescriptor sld) {
if (sld != null) {
for (StyledLayer layer : sld.layers()) {
if (layer instanceof UserLayer) {
UserLayer userLayer = (UserLayer) layer;
if (userLayer.getInlineFeatureDatastore() != null) {
return true;
}
}
}
}
return false;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:InlineFeatureUtils.java
示例13: extractUserLayers
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Extract user layers from an SLD.
*
* @param sld the sld
* @return the list of user layers
*/
public static List<UserLayer> extractUserLayers(StyledLayerDescriptor sld) {
List<UserLayer> userLayerList = new ArrayList<UserLayer>();
if (sld != null) {
for (StyledLayer layer : sld.layers()) {
if (layer instanceof UserLayer) {
UserLayer userLayer = (UserLayer) layer;
userLayerList.add(userLayer);
}
}
}
return userLayerList;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:InlineFeatureUtils.java
示例14: populateUserLayer
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Populate text field.
*
* @param fieldId the field id
* @param value the user layer
*/
public void populateUserLayer(FieldIdEnum fieldId, UserLayer value) {
if (fieldConfigManager == null) {
return;
}
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
((FieldConfigValuePopulateInterface) fieldConfig).populateField(value);
} else {
ConsoleManager.getInstance().error(this, String.format("populateUserLayer - %s : %s",
Localisation.getString(StandardPanel.class, "StandardPanel.unknownField"),
fieldId));
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:FieldConfigPopulation.java
示例15: replaceStyledLayer
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Replace styled user layer.
*
* @param newUserLayer the new user layer
*/
public void replaceStyledLayer(UserLayer newUserLayer) {
if (this.sld == null) {
return;
}
StyledLayer[] styledLayerList = this.sld.getStyledLayers();
int indexFound = -1;
int index = 0;
StyledLayer oldUserLayer = null;
for (StyledLayer styledLayer : styledLayerList) {
if (styledLayer == this.symbolData.getStyledLayer()) {
oldUserLayer = styledLayer;
indexFound = index;
break;
} else {
index++;
}
}
if (indexFound > -1) {
styledLayerList[indexFound] = newUserLayer;
this.sld.setStyledLayers(styledLayerList);
setStyledLayer(newUserLayer);
}
for (SLDTreeUpdatedInterface listener : treeUpdateListenerList) {
listener.updateNode(oldUserLayer, newUserLayer);
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:36,代码来源:SelectedSymbol.java
示例16: addNewStyledLayer
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Adds the new user styled layer.
*
* @param userLayer the user layer
*/
public void addNewStyledLayer(UserLayer userLayer) {
if (this.sld == null) {
ConsoleManager.getInstance().error(this, "sld == null");
} else {
this.sld.addStyledLayer(userLayer);
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:13,代码来源:SelectedSymbol.java
示例17: visit
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/** (non-Javadoc)
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.UserLayer)
*/
public void visit(UserLayer layer) {
Style[] style = layer.getUserStyles();
int length = style.length;
Style[] styleCopy = new Style[length];
for (int i = 0; i < length; i++) {
if (style[i] != null) {
style[i].accept(this);
styleCopy[i] = (Style) pages.pop();
}
}
FeatureTypeConstraint[] lfc = layer.getLayerFeatureConstraints();
FeatureTypeConstraint[] lfcCopy = new FeatureTypeConstraint[lfc.length];
length = lfc.length;
for (int i = 0; i < length; i++) {
if (lfc[i] != null) {
lfc[i].accept(this);
lfcCopy[i] = (FeatureTypeConstraint) pages.pop();
}
}
UserLayer copy = sf.createUserLayer();
copy.setName(layer.getName());
copy.setUserStyles(styleCopy);
copy.setLayerFeatureConstraints(lfcCopy);
// Reuse the existing inline feature data store
copy.setInlineFeatureDatastore(layer.getInlineFeatureDatastore());
copy.setInlineFeatureType(layer.getInlineFeatureType());
if (STRICT && !copy.equals(layer)) {
throw new IllegalStateException("Was unable to duplicate provided UserLayer:" + layer);
}
pages.push(copy);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:41,代码来源:InlineDatastoreVisitor.java
示例18: testConnectToInlineDataSource
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.datasource.impl.DataSourceImpl#connect()}.
*/
@Test
public void testConnectToInlineDataSource() {
DataSourceImpl ds = new DataSourceImpl();
DummyInlineSLDFile editorFile = new DummyInlineSLDFile();
DummyDataSourceUpdate dataSourceUpdateListener = new DummyDataSourceUpdate();
ds.addListener(dataSourceUpdateListener);
CreateDataSourceInterface internalDataSource = new DummyCreateDataSource();
CreateDataSourceInterface externalDataSource = new DummyCreateDataSource();
CreateDataSourceInterface inlineDataSource = new CreateInlineDataSource();
ds.setDataSourceCreation(internalDataSource, externalDataSource, inlineDataSource);
ds.connect("typeName", editorFile, null);
assertTrue(dataSourceUpdateListener.hasBeenCalled());
assertEquals(GeometryTypeEnum.UNKNOWN, dataSourceUpdateListener.geometryType);
assertFalse(dataSourceUpdateListener.isConnectedToDataSourceFlag);
Collection<PropertyDescriptor> fieldList = ds.getPropertyDescriptorList();
assertNull(fieldList);
FeatureSource<SimpleFeatureType, SimpleFeature> exampleLayer = ds.getExampleFeatureSource();
assertNull(exampleLayer);
Map<UserLayer, FeatureSource<SimpleFeatureType, SimpleFeature>> userLayerMap = ds
.getUserLayerFeatureSource();
assertEquals(1, userLayerMap.size());
assertFalse(dataSourceUpdateListener.hasBeenCalled());
ds.updateUserLayers();
assertTrue(dataSourceUpdateListener.hasBeenCalled());
DataSourcePropertiesInterface dsi = ds.getDataConnectorProperties();
assertNotNull(dsi);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:41,代码来源:DataSourceImplTest.java
示例19: testUserLayerDetails
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#UserLayerDetails(com.sldeditor.filter.v2.function.FunctionNameInterface)}.
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#populate(com.sldeditor.common.data.SelectedSymbol)}.
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#dataChanged(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#getFieldDataManager()}.
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#isDataPresent()}.
* Test method for {@link com.sldeditor.ui.detail.UserLayerDetails#preLoadSymbol()}.
*/
@Test
public void testUserLayerDetails() {
UserLayerDetails panel = new UserLayerDetails();
panel.populate(null);
// Set up test data
StyledLayerDescriptor sld = DefaultSymbols.createNewSLD();
SelectedSymbol.getInstance().createNewSLD(sld);
UserLayer userLayer = DefaultSymbols.createNewUserLayer();
String expectedUserValue = "user layer test value";
userLayer.setName(expectedUserValue);
userLayer.addUserStyle(DefaultSymbols.createNewStyle());
sld.layers().add(userLayer);
SelectedSymbol.getInstance().addNewStyledLayer(userLayer);
SelectedSymbol.getInstance().setStyledLayer(userLayer);
panel.populate(SelectedSymbol.getInstance());
panel.dataChanged(null);
GraphicPanelFieldManager fieldDataManager = panel.getFieldDataManager();
assertNotNull(fieldDataManager);
panel.dataChanged(FieldIdEnum.INLINE_FEATURE);
FieldConfigString nameField = (FieldConfigString) fieldDataManager.get(FieldIdEnum.NAME);
assertTrue(expectedUserValue.compareTo(nameField.getStringValue()) == 0);
assertTrue(panel.isDataPresent());
// Reset to default value
panel.preLoadSymbol();
assertTrue("".compareTo(nameField.getStringValue()) == 0);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:40,代码来源:UserLayerDetailsTest.java
示例20: testFieldConfigPopulation
import org.geotools.styling.UserLayer; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#FieldConfigPopulation(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testFieldConfigPopulation() {
FieldIdEnum fieldId = FieldIdEnum.UNKNOWN;
FieldConfigPopulation obj = new FieldConfigPopulation(null);
obj.populateBooleanField(fieldId, Boolean.TRUE);
obj.populateComboBoxField(fieldId, "");
obj.populateColourField(fieldId, null);
obj.populateColourMapField(FieldIdEnum.ANCHOR_POINT_V, (ColorMap) null);
obj.populateFontField(FieldIdEnum.ANCHOR_POINT_V, (Font) null);
obj.populateTextField(fieldId, (String) null);
obj.populateDoubleField(fieldId, (Double) null);
obj.populateIntegerField(fieldId, (Integer) null);
obj.populateField(fieldId, (Expression) null);
obj.populateUserLayer(fieldId, (UserLayer) null);
obj.populateFieldTypeConstraint(fieldId, (List<FeatureTypeConstraint>) null);
assertNull(obj.getExpression(fieldId));
assertFalse(obj.getBoolean(fieldId));
assertEquals(0, obj.getInteger(fieldId));
assertTrue(Math.abs(obj.getDouble(fieldId) - 0.0) < 0.001);
assertTrue(obj.getText(fieldId).compareTo("") == 0);
assertNull(obj.getComboBox(fieldId));
assertNull(obj.getColourMap(fieldId));
assertNull(obj.getFieldConfig(fieldId));
assertNull(obj.getFeatureTypeConstraint(fieldId));
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:31,代码来源:FieldConfigPopulationTest.java
注:本文中的org.geotools.styling.UserLayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论