⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jtsalgorithms.java

📁 用于GIS(全球地理系统)的分析和处理的代码。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            return false;
        }                                                   
    }

    public boolean crosses(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);             
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);             
            return jtsGeom1.crosses(jtsGeom2);       
        } catch (Exception e) {
            System.out.println("## PREDICAT CROSSES AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }

    public boolean disjoint(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);             
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);             
            return jtsGeom1.disjoint(jtsGeom2);    
        } catch (Exception e) {
            System.out.println("## PREDICAT DISJOINT AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                      
    }    

    public boolean within(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
            return jtsGeom1.within(jtsGeom2);
        } catch (Exception e) {
            System.out.println("## PREDICAT WITHIN AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }
	
	public boolean isWithinDistance (GM_Object g1, GM_Object g2, double dist) {
		try {
			Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
			Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
			return jtsGeom1.isWithinDistance(jtsGeom2,dist);
		} catch (Exception e) {
			System.out.println("## PREDICAT iisWithinDistance AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
			e.printStackTrace();
			return false;
		}                                                   
	}
	
    public boolean intersects(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
            return jtsGeom1.intersects(jtsGeom2);
        } catch (Exception e) {
            System.out.println("## PREDICAT INTERSECTS AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }

    public boolean overlaps(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
            return jtsGeom1.overlaps(jtsGeom2);
        } catch (Exception e) {
            System.out.println("## PREDICAT OVERLAPS AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }

    public boolean touches(GM_Object g1, GM_Object g2) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
            return jtsGeom1.touches(jtsGeom2);
        } catch (Exception e) {
            System.out.println("## PREDICAT TOUCHES AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }

    public boolean isEmpty(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.isEmpty();
        } catch (Exception e) {
            System.out.println("## ISEMPTY() AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                   
    }

    public boolean isSimple(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.isSimple();
        } catch (Exception e) {
            System.out.println("## ISSIMPLE() AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                               
    }

    public boolean isValid(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.isValid();
        } catch (Exception e) {
            System.out.println("## ISVALID() AVEC JTS : PROBLEME (le resultat renvoie FALSE) ##");
            e.printStackTrace();
            return false;
        }                                                               
    }

    public double distance(GM_Object g1, GM_Object g2)  {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);             
            Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);             
            return jtsGeom1.distance(jtsGeom2);   
        } catch (Exception e) {
            System.out.println("## DISTANCE() AVEC JTS : PROBLEME (le resultat renvoie 0.0) ##");
            e.printStackTrace();
            return 0.0;
        }                                                                               
    }    

    public double area(GM_Object geom) {
        try {
            Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(geom);             
            return jtsGeom1.getArea();     
        } catch (Exception e) {
            System.out.println("## AREA() AVEC JTS : PROBLEME (le resultat renvoie 0.0) ##");
            e.printStackTrace();
            return 0.0;
        }                                                                               
    }    

    public double length(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.getLength();
        } catch (Exception e) {
            System.out.println("## LENGTH() AVEC JTS : PROBLEME (le resultat renvoie 0.0) ##");
            e.printStackTrace();
            return 0.0;
        }                                                                                           
    }

    public int dimension(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.getDimension();
        } catch (Exception e) {
            System.out.println("## DIMENSION() AVEC JTS : PROBLEME (le resultat renvoie 0) ##");
            e.printStackTrace();
            return 0;
        }                                                                                                       
    }

    public int numPoints(GM_Object geom) {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            return jtsGeom.getNumPoints();
        } catch (Exception e) {
            System.out.println("## NUMPOINTS() AVEC JTS : PROBLEME (le resultat renvoie 0) ##");
            e.printStackTrace();
            return 0;
        }                                                                                                                   
    }    

    public GM_Object translate(GM_Object geom, final double tx, final double ty, final double tz)  {
        try {
            Geometry jtsGeom=JtsGeOxygene.makeJtsGeom(geom);
            CoordinateFilter translateCoord=new CoordinateFilter() {
                public void filter(Coordinate coord) {
                    coord.x+=tx;
                    coord.y+=ty;
                    coord.z+=tz;
                }
            };
            jtsGeom.apply(translateCoord);
            GM_Object result=JtsGeOxygene.makeGeOxygeneGeom(jtsGeom);
            return result;
        } catch (Exception e) {
            System.out.println("## TRANSLATE() AVEC JTS : PROBLEME (le resultat renvoie NULL) ##");
            e.printStackTrace();
            return null;
        }                                                                                                                   
    }
    
	public String relate(GM_Object g1, GM_Object g2) {
		try {
			Geometry jtsGeom1=JtsGeOxygene.makeJtsGeom(g1);
			Geometry jtsGeom2=JtsGeOxygene.makeJtsGeom(g2);
			return jtsGeom1.relate(jtsGeom2).toString();
		} catch (Exception e) {
			System.out.println("## RELATE AVEC JTS : PROBLEME ##");
			e.printStackTrace();
			return " RELATE AVEC JTS : PROBLEME ";
		}                                                   
	}


} // class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -