src/main/java/com/mxgraph/util/mxCurve.java
public void updateCurve(List<mxPoint> newPoints)
	{
		boolean pointsChanged = false;

		// If any of the new points are null, ignore the list
		for (mxPoint point : newPoints)
		{
			if (point == null)
			{
				return;
			}
		}

		if (newPoints.size() != guidePoints.size())
		{
			pointsChanged = true;
		}
		else
		{
			// Check for a constant translation of all guide points. In that 
			// case apply the translation directly to all curves.
			// Also check whether all of the translations are trivial
			if (newPoints.size() == guidePoints.size() && newPoints.size() > 1
					&& guidePoints.size() > 1)
			{
				boolean constantTranslation = true;
				boolean trivialTranslation = true;
				mxPoint newPoint0 = newPoints.get(0);
				mxPoint oldPoint0 = guidePoints.get(0);
				double transX = newPoint0.getX() - oldPoint0.getX();
				double transY = newPoint0.getY() - oldPoint0.getY();

				if (Math.abs(transX) > 0.01 || Math.abs(transY) > 0.01)
				{
					trivialTranslation = false;
				}

				for (int i = 1; i < newPoints.size(); i++)
				{
					double nextTransX = newPoints.get(i).getX()
							- guidePoints.get(i).getX();
					double nextTransY = newPoints.get(i).getY()
							- guidePoints.get(i).getY();

					if (Math.abs(transX - nextTransX) > 0.01
							|| Math.abs(transY - nextTransY) > 0.01)
					{
						constantTranslation = false;
					}

					if (Math.abs(nextTransX) > 0.01
							|| Math.abs(nextTransY) > 0.01)
					{
						trivialTranslation = false;
					}
				}

				if (trivialTranslation)
				{
					pointsChanged = false;
				}
				else if (constantTranslation)
				{
					pointsChanged = false;
					// Translate all stored points by the translation amounts
					Collection<mxPoint[]> curves = points.values();

					// Update all geometry information held by the curve
					// That is, all the curve points, the guide points
					// and the cached bounds
					for (mxPoint[] curve : curves)
					{
						for (int i = 0; i < curve.length; i++)
						{
							curve[i].setX(curve[i].getX() + transX);
							curve[i].setY(curve[i].getY() + transY);
						}
					}

					guidePoints = new ArrayList<mxPoint>(newPoints);
					minXBounds += transX;
					minYBounds += transY;
					maxXBounds += transX;
					maxYBounds += transY;
				}
				else
				{
					pointsChanged = true;
				}
			}
		}

		if (pointsChanged)
		{
			guidePoints = new ArrayList<mxPoint>(newPoints);
			points = new Hashtable<String, mxPoint[]>();
			valid = false;
		}
	}
/**
	 * Updates the existing curve using the points passed in. 
	 * @param newPoints the new guide points
	 */
Updates the existing curve using the points passed in.
@param newPoints the new guide points
Updates the existing curve using the points passed in . @param newPoints the new guide points
public void updateCurve(List<mxPoint> newPoints)
	{
		boolean pointsChanged = false;
		for (mxPoint point : newPoints)
		{
			if (point == null)
			{
				return;
			}
		}
		if (newPoints.size() != guidePoints.size())
		{
			pointsChanged = true;
		}
		else
		{
			if (newPoints.size() == guidePoints.size() && newPoints.size() > 1
					&& guidePoints.size() > 1)
			{
				boolean constantTranslation = true;
				boolean trivialTranslation = true;
				mxPoint newPoint0 = newPoints.get(0);
				mxPoint oldPoint0 = guidePoints.get(0);
				double transX = newPoint0.getX() - oldPoint0.getX();
				double transY = newPoint0.getY() - oldPoint0.getY();
				if (Math.abs(transX) > 0.01 || Math.abs(transY) > 0.01)
				{
					trivialTranslation = false;
				}
				for (int i = 1; i < newPoints.size(); i++)
				{
					double nextTransX = newPoints.get(i).getX()
							- guidePoints.get(i).getX();
					double nextTransY = newPoints.get(i).getY()
							- guidePoints.get(i).getY();
					if (Math.abs(transX - nextTransX) > 0.01
							|| Math.abs(transY - nextTransY) > 0.01)
					{
						constantTranslation = false;
					}
					if (Math.abs(nextTransX) > 0.01
							|| Math.abs(nextTransY) > 0.01)
					{
						trivialTranslation = false;
					}
				}
				if (trivialTranslation)
				{
					pointsChanged = false;
				}
				else if (constantTranslation)
				{
					pointsChanged = false;
					Collection<mxPoint[]> curves = points.values();
					for (mxPoint[] curve : curves)
					{
						for (int i = 0; i < curve.length; i++)
						{
							curve[i].setX(curve[i].getX() + transX);
							curve[i].setY(curve[i].getY() + transY);
						}
					}
					guidePoints = new ArrayList<mxPoint>(newPoints);
					minXBounds += transX;
					minYBounds += transY;
					maxXBounds += transX;
					maxYBounds += transY;
				}
				else
				{
					pointsChanged = true;
				}
			}
		}
		if (pointsChanged)
		{
			guidePoints = new ArrayList<mxPoint>(newPoints);
			points = new Hashtable<String, mxPoint[]>();
			valid = false;
		}
	}
public void updateCurve ( List < mxPoint > newPoints ) { boolean pointsChanged = false ; for ( mxPoint point : newPoints ) { if ( point == null ) { return ; } } if ( newPoints . size ( ) != guidePoints . size ( ) ) { pointsChanged = true ; } else { if ( newPoints . size ( ) == guidePoints . size ( ) && newPoints . size ( ) > 1 && guidePoints . size ( ) > 1 ) { boolean constantTranslation = true ; boolean trivialTranslation = true ; mxPoint newPoint0 = newPoints . get ( 0 ) ; mxPoint oldPoint0 = guidePoints . get ( 0 ) ; double transX = newPoint0 . getX ( ) - oldPoint0 . getX ( ) ; double transY = newPoint0 . getY ( ) - oldPoint0 . getY ( ) ; if ( Math . abs ( transX ) > 0.01 || Math . abs ( transY ) > 0.01 ) { trivialTranslation = false ; } for ( int i = 1 ; i < newPoints . size ( ) ; i ++ ) { double nextTransX = newPoints . get ( i ) . getX ( ) - guidePoints . get ( i ) . getX ( ) ; double nextTransY = newPoints . get ( i ) . getY ( ) - guidePoints . get ( i ) . getY ( ) ; if ( Math . abs ( transX - nextTransX ) > 0.01 || Math . abs ( transY - nextTransY ) > 0.01 ) { constantTranslation = false ; } if ( Math . abs ( nextTransX ) > 0.01 || Math . abs ( nextTransY ) > 0.01 ) { trivialTranslation = false ; } } if ( trivialTranslation ) { pointsChanged = false ; } else if ( constantTranslation ) { pointsChanged = false ; Collection < mxPoint [ ] > curves = points . values ( ) ; for ( mxPoint [ ] curve : curves ) { for ( int i = 0 ; i < curve . length ; i ++ ) { curve [ i ] . setX ( curve [ i ] . getX ( ) + transX ) ; curve [ i ] . setY ( curve [ i ] . getY ( ) + transY ) ; } } guidePoints = new ArrayList < mxPoint > ( newPoints ) ; minXBounds += transX ; minYBounds += transY ; maxXBounds += transX ; maxYBounds += transY ; } else { pointsChanged = true ; } } } if ( pointsChanged ) { guidePoints = new ArrayList < mxPoint > ( newPoints ) ; points = new Hashtable < String , mxPoint [ ] > ( ) ; valid = false ; } }
Updates the existing curve using the points passed in.
Updates the existing curve using the points passed in .
// If any of the new points are null, ignore the list // Check for a constant translation of all guide points. In that  // case apply the translation directly to all curves. // Also check whether all of the translations are trivial // Translate all stored points by the translation amounts // Update all geometry information held by the curve // That is, all the curve points, the guide points // and the cached bounds