當前位置: 首頁>>代碼示例>>Java>>正文


Java Geometry.union方法代碼示例

本文整理匯總了Java中com.vividsolutions.jts.geom.Geometry.union方法的典型用法代碼示例。如果您正苦於以下問題:Java Geometry.union方法的具體用法?Java Geometry.union怎麽用?Java Geometry.union使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vividsolutions.jts.geom.Geometry的用法示例。


在下文中一共展示了Geometry.union方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEnvelope

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
@Override
public List<String> getEnvelope(final List<String> wkts)
		throws IllegalArgumentException {
	Geometry resultGeometry = null;

	final List<String> result = new ArrayList<String>();

	for (final String wkt : wkts) {
		Geometry geom = getGeometry(wkt);
		geom = geom.buffer(TOLERANCIA_ENVELOPE);

		if (resultGeometry == null) {
			resultGeometry = geom;
		} else {
			resultGeometry = resultGeometry.union(geom);
		}
	}

	if (resultGeometry != null) {
		result.add(resultGeometry.getEnvelope().toText());
	}

	return result;
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:25,代碼來源:JTSServiceImpl.java

示例2: nodeLines

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public Collection<Geometry> nodeLines(final Collection<Geometry> lines) {
	final GeometryFactory gf = new GeometryFactory();
	final Geometry linesGeom = gf.createMultiLineString(GeometryFactory
			.toLineStringArray(lines));
	Geometry unionInput = gf.createMultiLineString(null);
	final Geometry point = extractPoint(lines);
	if (point != null)
		unionInput = point;

	final Geometry noded = linesGeom.union(unionInput);
	final List<Geometry> nodedList = new ArrayList<Geometry>();
	nodedList.add(noded);
	return nodedList;
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:15,代碼來源:LineNoder.java

示例3: divide

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public List<String> divide(String divisionLine, String lineToDivide)
		throws IllegalArgumentException {

	Geometry geomToDivide = getGeometry(lineToDivide);
	Geometry divisionGeom = getGeometry(divisionLine);
	Geometry unionGeom = geomToDivide.union(divisionGeom);

	List<Geometry> lines = linealize(unionGeom);
	List<Geometry> segments = getSegments(geomToDivide, lines);
	return getWkts(segments);
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:12,代碼來源:DivideLineStringTool.java

示例4: getCriticalPoint

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
/**
 * Get the path index beyond which a robot should not navigate, given the {@link TrajectoryEnvelope} of another robot.  
 * @param te1 The {@link TrajectoryEnvelope} of the leading robot.
 * @param te2 The {@link TrajectoryEnvelope} of the yielding robot.
 * @param currentPIR1 The current path index of the leading robot.
 * @param te1Start The path index
 * @param te1End
 * @param te2Start
 * @return
 */
public int getCriticalPoint(int yieldingRobotID, CriticalSection cs, int leadingRobotCurrentPathIndex) {

	//Number of additional path points robot 2 should stay behind robot 1
	int TRAILING_PATH_POINTS = 3;

	int leadingRobotStart = -1;
	int yieldingRobotStart = -1;
	int leadingRobotEnd = -1;
	int yieldingRobotEnd = -1;
	if (cs.getTe1().getRobotID() == yieldingRobotID) {
		leadingRobotStart = cs.getTe2Start();
		yieldingRobotStart = cs.getTe1Start();
		leadingRobotEnd = cs.getTe2End();
		yieldingRobotEnd = cs.getTe1End();
	}
	else {
		leadingRobotStart = cs.getTe1Start();
		yieldingRobotStart = cs.getTe2Start();
		leadingRobotEnd = cs.getTe1End();
		yieldingRobotEnd = cs.getTe2End();
	}

	TrajectoryEnvelope leadingRobotTE = null;
	TrajectoryEnvelope yieldingRobotTE = null;
	if (cs.getTe1().getRobotID() == yieldingRobotID) {
		leadingRobotTE = cs.getTe2();
		yieldingRobotTE = cs.getTe1();
	}
	else {
		leadingRobotTE = cs.getTe1();
		yieldingRobotTE = cs.getTe2();			
	}

	if (leadingRobotCurrentPathIndex <= leadingRobotStart) {
		return Math.max(0, yieldingRobotStart-TRAILING_PATH_POINTS);
	}

	//Compute sweep of robot 1's footprint from current position to LOOKAHEAD
	Pose leadingRobotPose = leadingRobotTE.getTrajectory().getPose()[leadingRobotCurrentPathIndex];
	Geometry leadingRobotInPose = TrajectoryEnvelope.getFootprint(leadingRobotTE.getFootprint(), leadingRobotPose.getX(), leadingRobotPose.getY(), leadingRobotPose.getTheta());
	for (int i = leadingRobotCurrentPathIndex+1; i <= leadingRobotEnd; i++) {
		Pose leadingRobotNextPose = leadingRobotTE.getTrajectory().getPose()[i];
		leadingRobotInPose = leadingRobotInPose.union(TrajectoryEnvelope.getFootprint(leadingRobotTE.getFootprint(), leadingRobotNextPose.getX(), leadingRobotNextPose.getY(), leadingRobotNextPose.getTheta()));			
	}

	//Return pose at which yielding robot should stop given driving robot's projected sweep
	for (int i = yieldingRobotStart; i < yieldingRobotEnd; i++) {
		Pose yieldingRobotPose = yieldingRobotTE.getTrajectory().getPose()[i];
		Geometry yieldingRobotInPose = TrajectoryEnvelope.getFootprint(yieldingRobotTE.getFootprint(), yieldingRobotPose.getX(), yieldingRobotPose.getY(), yieldingRobotPose.getTheta());
		if (leadingRobotInPose.intersects(yieldingRobotInPose)) {
			return Math.max(0, i-TRAILING_PATH_POINTS);
		}
	}

	//The only situation where the above has not returned is when robot 2 should
	//stay "parked", therefore wait at index 0
	return Math.max(0, yieldingRobotStart-TRAILING_PATH_POINTS);

}
 
開發者ID:FedericoPecora,項目名稱:coordination_oru,代碼行數:70,代碼來源:TrajectoryEnvelopeCoordinator.java


注:本文中的com.vividsolutions.jts.geom.Geometry.union方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。