Revision: 5656
          http://sourceforge.net/p/jump-pilot/code/5656
Author:   elnico
Date:     2018-01-03 16:00:38 +0000 (Wed, 03 Jan 2018)
Log Message:
-----------
Icons for layers according to geometry type in the Data Store Layer panel

Modified Paths:
--------------
    core/trunk/ChangeLog
    
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/datastore/DataStoreLayerRenderData.java

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2017-12-26 17:42:23 UTC (rev 5655)
+++ core/trunk/ChangeLog        2018-01-03 16:00:38 UTC (rev 5656)
@@ -3,6 +3,9 @@
 # 2. make sure that lines break at 80 chars for constricted display situations
 #<-------------------------------- 80 chars 
---------------------------------->#
 
+2018-01-03 Nicolas Ribot <nicolas.ri...@gmail.com>
+  * Icons for layers according to geometry type in the Data Store Layer panel
+
 2017-12-10 ede
   * final bugfix: "#463 Starting OJ with java9 throws several exceptions"
     OJ should be generally java 9 ready now

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/datastore/DataStoreLayerRenderData.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/datastore/DataStoreLayerRenderData.java
  2017-12-26 17:42:23 UTC (rev 5655)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/datastore/DataStoreLayerRenderData.java
  2018-01-03 16:00:38 UTC (rev 5656)
@@ -7,10 +7,24 @@
 
 import com.vividsolutions.jump.datastore.DataStoreLayer;
 import java.awt.Color;
+
+import com.vividsolutions.jump.workbench.ui.images.IconLoader;
 import org.netbeans.swing.outline.RenderDataProvider;
 
+import javax.swing.*;
+
 public class DataStoreLayerRenderData implements RenderDataProvider {
 
+    // icons to display according to node geometry type
+    private ImageIcon gc = IconLoader.icon("EditGeometryCollection.gif");
+    private ImageIcon point = IconLoader.icon("EditPoint.gif");
+    private ImageIcon mpoint = IconLoader.icon("EditMultiPoint.gif");
+    private ImageIcon line = IconLoader.icon("EditLineString.gif");
+    private ImageIcon mline = IconLoader.icon("EditMultiLineString.gif");
+    private ImageIcon poly = IconLoader.icon("EditPolygon.gif");
+    private ImageIcon mpoly = IconLoader.icon("EditMultiPolygon.gif");
+    private ImageIcon lring = IconLoader.icon("EditLinearRing.gif");
+
     @Override
     public java.awt.Color getBackground(Object o) {
         if (!(o instanceof String)) {
@@ -41,8 +55,33 @@
 
     @Override
     public javax.swing.Icon getIcon(Object o) {
-        return null;
-
+        // Nicolas Ribot: 03 jan 2018: adds custom icons according to layer 
geometry type
+        if (o instanceof DataStoreLayer) {
+            switch (((DataStoreLayer) o).getGeoCol().getType().toLowerCase()) {
+                case "geometrycollection":
+                case "geometry":
+                case "sdo_geometry":
+                    return this.gc;
+                case "point":
+                    return this.point;
+                case "multipoint":
+                    return this.mpoint;
+                case "linestring":
+                    return this.line;
+                case "multilinestring":
+                    return this.mline;
+                case "polygon":
+                    return this.poly;
+                case "multipolygon":
+                    return this.mpoly;
+                case "linearring":
+                    return this.lring;
+                default:
+                    return null;
+            }
+        } else {
+            return null;
+        }
     }
 
     @Override


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to