本文整理匯總了Java中org.geotools.styling.ColorMap類的典型用法代碼示例。如果您正苦於以下問題:Java ColorMap類的具體用法?Java ColorMap怎麽用?Java ColorMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ColorMap類屬於org.geotools.styling包,在下文中一共展示了ColorMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Encode colour map entries into a string.
*
* @param colourMap the colour map
* @return the string
*/
public static String encode(ColorMap colourMap) {
StringBuilder sb = new StringBuilder();
for (ColorMapEntry entry : colourMap.getColorMapEntries()) {
sb.append((entry.getLabel() == null) ? "" : entry.getLabel());
sb.append(SEPARATOR);
sb.append(entry.getColor());
sb.append(SEPARATOR);
sb.append(Double.valueOf(entry.getOpacity().toString()));
sb.append(SEPARATOR);
sb.append(entry.getQuantity());
sb.append(ENTRY_SEPARATOR);
}
return sb.toString();
}
示例2: populate
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Populate.
*
* @param value the value
*/
public void populate(ColorMap value) {
colourMapList.clear();
for (ColorMapEntry colourMapEntry : value.getColorMapEntries()) {
Expression colourExpression = colourMapEntry.getColor();
Expression opacityExpression = colourMapEntry.getOpacity();
Expression quantityExpression = colourMapEntry.getQuantity();
String label = colourMapEntry.getLabel();
ColourMapData data = new ColourMapData();
data.setColour(colourExpression);
data.setOpacity(opacityExpression);
data.setQuantity(quantityExpression);
data.setLabel(label);
colourMapList.add(data);
}
this.fireTableDataChanged();
}
示例3: populateField
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Populate field.
*
* @param value the value
*/
@Override
public void populateField(ColorMap value) {
if (model != null) {
if (value != null) {
if (colourRampConfig != null) {
colourRampConfig.populate(value);
}
model.populate(value);
if (colourMapEntryPanel != null) {
colourMapEntryPanel.setSelectedEntry(null);
}
UndoManager.getInstance()
.addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, value));
oldValueObj = value;
valueUpdated();
}
}
}
示例4: testGetStringValue
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getStringValue()}.
*/
@Test
public void testGetStringValue() {
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
ColorMapEntryImpl entry1 = new ColorMapEntryImpl();
entry1.setColor(ff.literal("#001122"));
entry1.setLabel("testlabel");
entry1.setOpacity(ff.literal(0.42));
entry1.setQuantity(ff.literal(42));
ColorMap expectedValue = new ColorMapImpl();
expectedValue.addColorMapEntry(entry1);
ColorMapEntryImpl entry2 = new ColorMapEntryImpl();
entry2.setColor(ff.literal("#551122"));
entry2.setLabel("testlabel2");
entry2.setOpacity(ff.literal(0.22));
entry2.setQuantity(ff.literal(12));
expectedValue.addColorMapEntry(entry2);
FieldConfigColourMap field = new FieldConfigColourMap(
new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.populateField(expectedValue);
assertTrue(field.getStringValue().compareTo(EncodeColourMap.encode(expectedValue)) == 0);
}
示例5: populate
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Populate the configuration fields.
*
* @param value the value
*/
public void populate(ColorMap value) {
ValueComboBoxData selectedValue = typeComboBox.getSelectedValue();
if (selectedValue != null) {
ColourRampPanelInterface selectedPanel = this.colourRampMapCache
.get(selectedValue.getKey());
if (selectedPanel != null) {
selectedPanel.populate(value);
}
}
}
示例6: populate
import org.geotools.styling.ColorMap; //導入依賴的package包/類
@Override
public void populate(ColorMap value) {
if (value != null) {
ColorMapEntry[] entries = value.getColorMapEntries();
if ((entries != null) && (entries.length > 0)) {
populateValue(minValueSpinner, entries[0]);
populateValue(maxValueSpinner, entries[entries.length - 1]);
}
}
}
示例7: createRGBImageSymbol
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Creates the rgb image symbol.
*
* @param sym the sym
* @param cov the cov
* @param raster the raster
*/
private void createRGBImageSymbol(RasterSymbolizer sym, GridCoverage2D cov,
WritableRaster raster) {
double dest;
List<Double> valueList = new ArrayList<Double>();
GridEnvelope2D gridRange2D = cov.getGridGeometry().getGridRange2D();
for (int x = 0; x < gridRange2D.getWidth(); x++) {
for (int y = 0; y < gridRange2D.getHeight(); y++) {
try {
dest = raster.getSampleDouble(x, y, 0);
if (!valueList.contains(dest)) {
valueList.add(dest);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
ColorMapImpl colourMap = new ColorMapImpl();
// Sort the unique sample values in ascending order
Collections.sort(valueList);
// Create colour amp entries in the colour map for all the sample values
for (Double value : valueList) {
ColorMapEntry entry = new ColorMapEntryImpl();
Literal colourExpression = ff
.literal(ColourUtils.fromColour(ColourUtils.createRandomColour()));
entry.setColor(colourExpression);
entry.setQuantity(ff.literal(value.doubleValue()));
colourMap.addColorMapEntry(entry);
}
colourMap.setType(ColorMap.TYPE_VALUES);
sym.setColorMap(colourMap);
}
示例8: populateColourMapField
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Populate colour map field.
*
* @param fieldId the field id
* @param colourMap the colour map
*/
public void populateColourMapField(FieldIdEnum fieldId, ColorMap colourMap) {
if (fieldConfigManager == null) {
return;
}
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
fieldConfig.populateField(colourMap);
}
}
示例9: getColourMap
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Gets the colour map.
*
* @param fieldId the field id
* @return the colour map
*/
public ColorMap getColourMap(FieldIdEnum fieldId) {
if (fieldConfigManager != null) {
FieldConfigValuePopulateInterface fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
return fieldConfig.getColourMap();
}
}
return null;
}
示例10: getColourMap
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Gets the colour map.
*
* @return the colour map
*/
public ColorMap getColourMap() {
ColorMap colourMap = new ColorMapImpl();
for (ColourMapData data : colourMapList) {
ColorMapEntry entry = createColourMapEntry(data);
colourMap.addColorMapEntry(entry);
}
return colourMap;
}
示例11: getColourMap
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Gets the string value.
*
* @return the string value
*/
@Override
public ColorMap getColourMap() {
if (table != null) {
return model.getColourMap();
}
return null;
}
示例12: undoAction
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Undo action.
*
* @param undoRedoObject the undo/redo object
*/
@Override
public void undoAction(UndoInterface undoRedoObject) {
if ((table != null) && (undoRedoObject != null)) {
if (undoRedoObject.getOldValue() instanceof ColorMap) {
ColorMap oldValue = (ColorMap) undoRedoObject.getOldValue();
populateField(oldValue);
}
}
}
示例13: redoAction
import org.geotools.styling.ColorMap; //導入依賴的package包/類
/**
* Redo action.
*
* @param undoRedoObject the undo/redo object
*/
@Override
public void redoAction(UndoInterface undoRedoObject) {
if ((table != null) && (undoRedoObject != null)) {
if (undoRedoObject.getNewValue() instanceof ColorMap) {
ColorMap newValue = (ColorMap) undoRedoObject.getNewValue();
populateField(newValue);
}
}
}
示例14: colourMapUpdated
import org.geotools.styling.ColorMap; //導入依賴的package包/類
@Override
public void colourMapUpdated() {
ColorMap colourMap = model.getColourMap();
UndoManager.getInstance()
.addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, colourMap));
oldValueObj = colourMap;
valueUpdated();
}
示例15: testFieldConfigPopulation
import org.geotools.styling.ColorMap; //導入依賴的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));
}