public GeometryStylePanel(final GeometryStyleRenderer geometryStyleRenderer) { super(geometryStyleRenderer, true); this.geometryStyleRenderer = geometryStyleRenderer; this.geometryStyle = geometryStyleRenderer.getStyle(); final AbstractRecordLayer layer = geometryStyleRenderer.getLayer(); final RecordDefinition recordDefinition = layer.getRecordDefinition(); final FieldDefinition geometryField = recordDefinition.getGeometryField(); if (geometryField != null) { this.geometryDataType = geometryField.getDataType(); if (DataTypes.GEOMETRY_COLLECTION.equals(this.geometryDataType)) { this.geometryDataType = DataTypes.GEOMETRY; } else if (DataTypes.MULTI_POINT.equals(this.geometryDataType)) { this.geometryDataType = DataTypes.POINT; } else if (DataTypes.MULTI_LINE_STRING.equals(this.geometryDataType)) { this.geometryDataType = DataTypes.LINE_STRING; } else if (DataTypes.MULTI_POLYGON.equals(this.geometryDataType)) { this.geometryDataType = DataTypes.POLYGON; } final JPanel panel = new JPanel(new BorderLayout()); add(panel, 1); final JPanel stylePanels = new JPanel(new VerticalLayout(5)); panel.add(stylePanels, BorderLayout.CENTER); this.previews = Panels.titledTransparentVerticalLayout("Preview", 5); final JPanel previewContainer = new JPanel(new VerticalLayout()); previewContainer.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); previewContainer.add(this.previews); panel.add(previewContainer, BorderLayout.EAST); if (DataTypes.GEOMETRY.equals(this.geometryDataType)) { addMarkerStylePanel(stylePanels, this.geometryStyle); addLineStylePanel(stylePanels, this.geometryStyle); addPolygonStylePanel(stylePanels, this.geometryStyle); this.previews.add(new MarkerStylePreview(this.geometryStyle)); addGeometryPreview(DataTypes.LINE_STRING); addGeometryPreview(DataTypes.POLYGON); } else if (DataTypes.POINT.equals(this.geometryDataType)) { addMarkerStylePanel(stylePanels, this.geometryStyle); this.previews.add(new MarkerStylePreview(this.geometryStyle)); } else if (DataTypes.LINE_STRING.equals(this.geometryDataType)) { addLineStylePanel(stylePanels, this.geometryStyle); addGeometryPreview(DataTypes.LINE_STRING); } else if (DataTypes.POLYGON.equals(this.geometryDataType)) { addLineStylePanel(stylePanels, this.geometryStyle); addPolygonStylePanel(stylePanels, this.geometryStyle); addGeometryPreview(DataTypes.POLYGON); } } }
public void setBoundingBox(final BoundingBox boundingBox) { final RecordDefinition recordDefinition = this.recordDefinition; if (recordDefinition != null) { this.boundingBox = boundingBox; if (boundingBox != null) { final FieldDefinition geometryField = recordDefinition.getGeometryField(); if (geometryField != null) { final GeometryFactory geometryFactory = geometryField.getProperty(FieldProperties.GEOMETRY_FACTORY); if (geometryFactory != null) { this.boundingBox = boundingBox.convert(geometryFactory); } } } } }