Revision: 4803
          http://sourceforge.net/p/jump-pilot/code/4803
Author:   ma15569
Date:     2016-01-27 15:06:17 +0000 (Wed, 27 Jan 2016)
Log Message:
-----------
Restored Layer class to previous 4801 version
Correct bug on methods of RasterImageLayer class

Modified Paths:
--------------
    core/trunk/src/com/vividsolutions/jump/workbench/model/Layer.java
    core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java

Modified: core/trunk/src/com/vividsolutions/jump/workbench/model/Layer.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/workbench/model/Layer.java   
2016-01-26 06:25:08 UTC (rev 4802)
+++ core/trunk/src/com/vividsolutions/jump/workbench/model/Layer.java   
2016-01-27 15:06:17 UTC (rev 4803)
@@ -592,219 +592,4 @@
     }
     expressions = null;
   }
-  /*
-   *  Giuseppe Aruta 25/01/2015
-   *  Some experimental boolean methods 
-   */
- 
-  /**
-   * @return true if the layer is  a temporary layer
-   * Both layers in memory and layes stored into TEMP folder are considered
-   * as "Temporary layers"
-   */
-  public boolean isTemporaryLayer() {
-         if (!hasReadableDataSource() 
-                         || 
getName().contains(System.getProperty("java.io.tmpdir"))) {
-                 return true;
-             } else{
-                 return false;
-             }
-         } 
- 
-  /**
-    * @return true if the layer has been modified 
-   */
-  public boolean isModifiedLayer() {
-         if (isFeatureCollectionModified()) {
-                 return true;
-             } else{
-                 return false;
-             }
-         } 
-    
-  /**
-    * @return true if the layer is a vector layer (eg. SHP, JML, GML)
-   * excluding excluding Datastores and Image layers
-   */
-  public boolean isVectorLayer() {
-         if (!(getDataSourceQuery().getDataSource() instanceof 
DataStoreQueryDataSource) 
-                        &&((getStyle(ReferencedImageStyle.class) == null)) )  {
-                 return true;
-             } else{
-                 return false;
-             }
-         }
-    
-  /**
-    * @return true if the layer is an image Layer (eg. JPG, TIF, ECW)
-   */
-  public boolean isImageLayer() {
-      if (getStyle(ReferencedImageStyle.class) != null) {
-          return true;
-      } else{
-         return false;
-      }
-  }
-  
-  /**
-    * @return true if the ayer is a collection of
-   * Image layers (eg. JPG, TIF, ECW)
-   */
-  public boolean isMultipleImagesLayer() {
-      if (getStyle(ReferencedImageStyle.class) != null 
-                 && getFeatureCollectionWrapper().getFeatures().size()>1) {
-          return true;
-      } else{
-         return false;
-      }
-  }
-
-  /**
-    * @return true if the layer is a datastore layer (eg. Oracle, SpatiaLite, 
MySQL)
-   */
-  public boolean isDataStoreLayer() {
-      if (getDataSourceQuery().getDataSource() instanceof 
DataStoreQueryDataSource) {
-          return true;
-      } else{
-         return false;
-      }
-  }
-    
-  /**
-   * @return true if the layer is a system Layer
-   * currently Fence and Measure Layers
-   */
-  public boolean isSystemLayer() {
-         if (getName().equals(FenceLayerFinder.LAYER_NAME) 
-                         || getName().equals(MeasureLayerFinder.LAYER_NAME) )  
{
-                 return true;
-             } else{
-                 return false;
-             }
-         }
-  
-  /**
-    * @return true Check if the layer is a cad Layer
-   * following DXF PlugIn schema it defines Cad layer with
-   * the presence of COLOR and TEXT attributes
-   */
-  public boolean isCadLayer() {
-         if 
(getFeatureCollectionWrapper().getFeatureSchema().hasAttribute("COLOR") 
-                 && 
getFeatureCollectionWrapper().getFeatureSchema().hasAttribute("TEXT") )  {
-                 return true;
-             } else{
-                 return false;
-             }
-         }
-  /**
-    * @return true Check if the layer has different types of geometries 
(point, linestring, etc)
-   */
-  
-  public boolean isMixedGeometryTypes(){
-         String geoClass = "";
-                FeatureCollectionWrapper fcw = getFeatureCollectionWrapper();
-            Geometry geo = null;
-            boolean multipleGeoTypes = false;
-            for (@SuppressWarnings("unchecked")
-               Iterator<FeatureCollectionWrapper> i = 
fcw.getFeatures().iterator(); i.hasNext();) {
-                 geo = ((Feature) i.next()).getGeometry();
-                 if (geo != null) {
-                    if (geoClass.equals(""))
-                      geoClass = geo.getClass().getName();
-                    else if (!geo.getClass().getName().equals(geoClass))
-                      multipleGeoTypes = true;
-                  }
-                }
-            if (multipleGeoTypes) {
-                return true;
-            } else{
-                return false;
-            }
-  }
-  
-  /**
-   * 
-   * @return true if the layer is empty
-   */
-  
-  public boolean isEmpy(){
-         FeatureCollectionWrapper fcw = getFeatureCollectionWrapper();
-         if (fcw.isEmpty()){
-                 return true;
-        } else{
-               return false;
-        }
-        }
-  private final static String NO_FEATURES = I18N
-             
.get("org.openjump.core.ui.plugin.layer.LayerPropertiesPlugIn.No-Features"); // 
no features were found
- private final static String MULTIPLE_GEOMETRY_TYPES = I18N
-             
.get("org.openjump.core.ui.plugin.layer.LayerPropertiesPlugIn.Multiple-geometry-types");
 // mixed
-private final static String NULL_GEOMETRIES = I18N
-                     
.get("org.openjump.core.ui.plugin.layer.LayerPropertiesPlugIn.Null-Geometries");
-  
-       /**
-         * @return the geometry type of the layer (ex. point, linestring, 
polygon or multiple geometries) 
-        */
-       public String getGeometryType(){
-                String geoClass = "";
-                FeatureCollectionWrapper fcw = getFeatureCollectionWrapper();
-            int numFeatures = fcw.size();
-            Geometry geo = null;
-            boolean multipleGeoTypes = false;
-            for (@SuppressWarnings("unchecked")
-               Iterator<FeatureCollectionWrapper> i = 
fcw.getFeatures().iterator(); i.hasNext();) {
-                 geo = ((Feature) i.next()).getGeometry();
-                 if (geo != null) {
-                    if (geoClass.equals(""))
-                      geoClass = geo.getClass().getName();
-                    else if (!geo.getClass().getName().equals(geoClass))
-                      multipleGeoTypes = true;
-                  }
-                }
-            if (geoClass.equals(""))
-                geoClass = NULL_GEOMETRIES;
-            
-              if (numFeatures == 0)
-                        geoClass = NO_FEATURES; 
-              else {
-                  if (multipleGeoTypes) {
-                                geoClass = MULTIPLE_GEOMETRY_TYPES;
-                  } else {
-                        int dotPos = geoClass.lastIndexOf(".");
-                        if (dotPos > 0)
-                                  geoClass = geoClass.substring(dotPos + 1); 
-                       }
-              }
-          return geoClass; 
-       }
-       
-       private final static String NODATASOURCELAYER = I18N
-            
.get("org.openjump.core.ui.plugin.layer.LayerPropertiesPlugIn.nodatasourcelayer.message");
-       /**
-     *@return the File path of a RasterImageLayer.class
-     *eg. C/File/vectorname.shp
-     */
-    public String getFilePath() {
-       DataSourceQuery dsq = getDataSourceQuery();
-       String fileName = null;
-        if (dsq != null || 
!getName().contains(System.getProperty("java.io.tmpdir"))) {
-            Object fnameObj = dsq.getDataSource().getProperties()
-                    .get("File");
-            if (fnameObj == null) {
-                fnameObj = dsq
-                        .getDataSource()
-                        .getProperties()
-                        .get(DataStoreDataSource.CONNECTION_DESCRIPTOR_KEY);
-            }
-            if (fnameObj != null) {
-               fileName = fnameObj.toString();
-            }
-        } else{
-               fileName = NODATASOURCELAYER;
-        }
-
-        return fileName;
-    }
-       
-
 }
\ No newline at end of file

Modified: core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java
===================================================================
--- core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java  
2016-01-26 06:25:08 UTC (rev 4802)
+++ core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java  
2016-01-27 15:06:17 UTC (rev 4803)
@@ -1698,7 +1698,7 @@
      * as "Temporary layers"
      */
     public boolean isTemporaryLayer() {
-         if (getName().contains(System.getProperty("java.io.tmpdir"))) {
+         if (imageFileName.contains(System.getProperty("java.io.tmpdir"))) {
                  return true;
              } else{
                  return false;
@@ -1716,7 +1716,7 @@
      */
     public String getFilePath() {
        String fileName = null;
-       if (!getName().contains(System.getProperty("java.io.tmpdir"))) {
+       if (!imageFileName.contains(System.getProperty("java.io.tmpdir"))) {
                fileName = getImageFileName();
          } else{
                 fileName = NODATASOURCELAYER;


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to