Search in sources :

Example 11 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class ModeSelected method activate.

@Override
public void activate() {
    final AbstractRecordLayer layer = getLayer();
    addListeners(// 
    Property.addListenerRunnable(layer, AbstractRecordLayer.RECORDS_SELECTED, this::refresh));
    super.activate();
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 12 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class AbstractRecordLayerRenderer method wrapWithFilterStyle.

public FilterMultipleRenderer wrapWithFilterStyle() {
    final AbstractRecordLayer layer = getLayer();
    final AbstractMultipleRenderer parent = (AbstractMultipleRenderer) getParent();
    final FilterMultipleRenderer newRenderer = new FilterMultipleRenderer(layer, parent);
    wrap(layer, parent, newRenderer);
    return newRenderer;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 13 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class AbstractRecordLayerRenderer method wrapWithMultipleStyle.

public MultipleRecordRenderer wrapWithMultipleStyle() {
    final AbstractRecordLayer layer = getLayer();
    final AbstractMultipleRenderer parent = (AbstractMultipleRenderer) getParent();
    final MultipleRecordRenderer newRenderer = new MultipleRecordRenderer(layer, parent);
    wrap(layer, parent, newRenderer);
    return newRenderer;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 14 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class GeometryStyleRenderer method newIcon.

@Override
public Icon newIcon() {
    final AbstractRecordLayer layer = getLayer();
    if (layer == null) {
        return ICON;
    } else {
        final GeometryStyle geometryStyle = getStyle();
        Shape shape = null;
        final DataType geometryDataType = layer.getGeometryType();
        if (DataTypes.POINT.equals(geometryDataType) || DataTypes.MULTI_POINT.equals(geometryDataType)) {
            return this.style.getMarker().newIcon(geometryStyle);
        } else if (DataTypes.LINE_STRING.equals(geometryDataType) || DataTypes.MULTI_LINE_STRING.equals(geometryDataType)) {
            shape = GeometryStylePreview.getLineShape(16);
        } else if (DataTypes.POLYGON.equals(geometryDataType) || DataTypes.MULTI_POLYGON.equals(geometryDataType)) {
            shape = getPolygonShape();
        } else {
            return ICON;
        }
        final BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
        final Graphics2D graphics = image.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        if (DataTypes.POLYGON.equals(geometryDataType) || DataTypes.MULTI_POLYGON.equals(geometryDataType)) {
            graphics.setPaint(geometryStyle.getPolygonFill());
            graphics.fill(shape);
        }
        final Color color = geometryStyle.getLineColor();
        graphics.setColor(color);
        graphics.draw(shape);
        graphics.dispose();
        return new ImageIcon(image);
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) GeometryStyle(com.revolsys.swing.map.layer.record.style.GeometryStyle) Shape(java.awt.Shape) Color(java.awt.Color) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) DataType(com.revolsys.datatype.DataType) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

Example 15 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class BaseStylePanel method newField.

@SuppressWarnings("unchecked")
protected Field newField(final String fieldName, final Class<?> fieldClass, final Object value) {
    Field field;
    if (fieldName.equals("visible")) {
        this.visibleField = new CheckBox(fieldName, value);
        field = this.visibleField;
    } else if (fieldName.equals("textFaceName")) {
        field = new FontChooserField(fieldName, (String) value);
    } else if (fieldName.endsWith("HorizontalAlignment")) {
        field = newHorizontalAlignmentField(fieldName, (String) value);
    } else if (fieldName.endsWith("VerticalAlignment")) {
        field = newVerticalAlignmentField(fieldName, (String) value);
    } else if (fieldName.equals("lineCap")) {
        field = newLineCapField((LineCap) value);
    } else if (fieldName.equals("lineJoin")) {
        field = newLineJoinField((LineJoin) value);
    } else if (fieldName.equals("lineDashArray")) {
        field = new DashField(fieldName, (List<Quantity<Length>>) value);
    } else if (fieldName.equals("queryFilter")) {
        final AbstractRecordLayer layer = getLayer();
        field = new QueryFilterField(layer, fieldName, (String) value);
        field.setFieldValue(value);
        Property.addListener(field, fieldName, this);
    } else if (fieldName.equals("marker")) {
        field = new MarkerField(fieldName, value);
    } else if (fieldName.endsWith("OrientationType")) {
        final ComboBox<String> orientationTypeField = ComboBox.newComboBox(fieldName, "auto", "none");
        orientationTypeField.setFieldValue(value);
        field = orientationTypeField;
    } else if (fieldName.equals("markerPlacementType")) {
        final ComboBox<String> placementField = ComboBox.newComboBox(fieldName, "auto", "center", "vertex(0)", "vertex(n)", "vertices", "segment(0)", "segment(n)", "segments");
        placementField.setFieldValue(value);
        field = placementField;
    } else if (fieldName.equals("textPlacementType")) {
        final ComboBox<String> placementField = ComboBox.newComboBox(fieldName, "auto", "center", "vertex(0)", "vertex(n)", "segment(0)", "segment(n)");
        placementField.setFieldValue(value);
        field = placementField;
    } else if (fieldName.endsWith("Scale")) {
        field = newScaleField(fieldName, (Long) value);
    } else if (Color.class.equals(fieldClass)) {
        field = new ColorChooserField(fieldName, (Color) value);
    } else if (Boolean.TYPE.equals(fieldClass) || Boolean.class.equals(fieldClass)) {
        field = new CheckBox(fieldName, value);
    } else if (Quantity.class.equals(fieldClass)) {
        field = new LengthMeasureTextField(fieldName, (Quantity<Length>) value, CustomUnits.PIXEL);
    } else {
        field = new TextField(fieldName, value, 40);
    }
    return field;
}
Also used : FontChooserField(com.revolsys.swing.field.FontChooserField) ComboBox(com.revolsys.swing.field.ComboBox) ColorChooserField(com.revolsys.swing.field.ColorChooserField) Color(java.awt.Color) Quantity(javax.measure.Quantity) LengthMeasureTextField(com.revolsys.swing.field.LengthMeasureTextField) FontChooserField(com.revolsys.swing.field.FontChooserField) MarkerField(com.revolsys.swing.map.component.MarkerField) JTextField(javax.swing.JTextField) Field(com.revolsys.swing.field.Field) TextField(com.revolsys.swing.field.TextField) ColorChooserField(com.revolsys.swing.field.ColorChooserField) Length(javax.measure.quantity.Length) CheckBox(com.revolsys.swing.field.CheckBox) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LengthMeasureTextField(com.revolsys.swing.field.LengthMeasureTextField) LengthMeasureTextField(com.revolsys.swing.field.LengthMeasureTextField) JTextField(javax.swing.JTextField) TextField(com.revolsys.swing.field.TextField) List(java.util.List) ArrayList(java.util.ArrayList) LineCap(com.revolsys.geometry.model.LineCap) MarkerField(com.revolsys.swing.map.component.MarkerField)

Aggregations

AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)71 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)35 Geometry (com.revolsys.geometry.model.Geometry)9 ArrayList (java.util.ArrayList)8 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)7 Layer (com.revolsys.swing.map.layer.Layer)7 List (java.util.List)7 Record (com.revolsys.record.Record)6 Condition (com.revolsys.record.query.Condition)6 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)6 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 Color (java.awt.Color)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 Point (com.revolsys.geometry.model.Point)3 Field (com.revolsys.swing.field.Field)3 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)3 WebColors (com.revolsys.awt.WebColors)2 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 Identifier (com.revolsys.identifier.Identifier)2 FieldDefinition (com.revolsys.record.schema.FieldDefinition)2