📄 segmentplane.java
字号:
this.firePropertyChange(PLANE_ALTITUDES, oldAltitudes, this.getPlaneAltitudes());
}
public LatLon[] getPlaneLocations()
{
return new LatLon[] {this.planeLocation1, this.planeLocation2};
}
public void setPlaneLocations(LatLon location1, LatLon location2)
{
if (location1 == null)
{
String message = "nullValue.Location1IsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (location2 == null)
{
String message = "nullValue.Location2IsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
LatLon[] oldLocations = this.getPlaneLocations();
this.planeLocation1 = location1;
this.planeLocation2 = location2;
this.setStateExpired();
this.firePropertyChange(PLANE_LOCATIONS, oldLocations, this.getPlaneLocations());
}
public double[] getGridCellDimensions()
{
return new double[] {this.gridCellWidth, this.gridCellHeight};
}
public void setGridCellDimensions(double width, double height)
{
if (width <= 0.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "width <= 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (height <= 0.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "height <= 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
double[] oldGridDimensions = this.getGridCellDimensions();
this.gridCellWidth = width;
this.gridCellHeight = height;
this.setStateExpired();
this.firePropertyChange(PLANE_GRID_DIMENSIONS, oldGridDimensions, this.getGridCellDimensions());
}
public int getPlaneOutlineMask()
{
return this.planeOutlineMask;
}
public void setPlaneOutlineMask(int mask)
{
this.planeOutlineMask = mask;
this.setStateExpired();
}
public int getBorderMask()
{
return this.borderMask;
}
public void setBorderMask(int mask)
{
this.borderMask = mask;
this.setStateExpired();
}
public Position[] getSegmentPositions()
{
return new Position[] {this.segmentBeginPosition, this.segmentEndPosition};
}
public void setSegmentPositions(Position position1, Position position2)
{
if (position1 == null)
{
String message = "nullValue.Position1IsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (position2 == null)
{
String message = "nullValue.Position2IsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.setSegmentBeginPosition(position1);
this.setSegmentEndPosition(position2);
}
public void setSegmentBeginPosition(Position position)
{
if (position == null)
{
String message = Logging.getMessage("nullValue.PositionIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
Position oldPosition = this.segmentBeginPosition;
this.segmentBeginPosition = position;
this.firePropertyChange(SEGMENT_BEGIN, oldPosition, this.segmentBeginPosition);
}
public void setSegmentEndPosition(Position position)
{
if (position == null)
{
String message = Logging.getMessage("nullValue.PositionIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
Position oldPosition = this.segmentEndPosition;
this.segmentEndPosition = position;
this.firePropertyChange(SEGMENT_END, oldPosition, this.segmentEndPosition);
}
public List<ControlPoint> getControlPoints()
{
return Collections.unmodifiableList(this.controlPointList);
}
public void setControlPoints(Iterable<? extends ControlPoint> controlPoints)
{
if (controlPoints == null)
{
String message = Logging.getMessage("nullValue.IterableIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.controlPointList.clear();
for (ControlPoint p : controlPoints)
{
this.addControlPoint(p);
}
this.setStateExpired();
}
protected void addControlPoint(ControlPoint controlPoint)
{
if (controlPoint.getOwner() != this)
{
String message = Logging.getMessage("generic.OwnerIsInvalid", controlPoint.getOwner());
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.controlPointList.add(controlPoint);
}
public Object getStateKey()
{
return new StateKey(this, this.serialNumber);
}
public Plane computeInfinitePlane(Globe globe)
{
if (globe == null)
{
String message = Logging.getMessage("nullValue.GlobeIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
BilinearInterpolator interp = this.createPlaneInterpolator(globe);
Vec4[] corners = interp.getCorners();
Vec4 a = corners[1].subtract3(corners[0]);
Vec4 b = corners[3].subtract3(corners[0]);
Vec4 n = a.cross3(b).normalize3();
double d = -corners[0].dot3(n);
if (n.equals(Vec4.ZERO))
{
return null;
}
return new Plane(n.x, n.y, n.z, d);
}
public BilinearInterpolator createPlaneInterpolator(Globe globe)
{
if (globe == null)
{
String message = Logging.getMessage("nullValue.GlobeIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
double[] altitudes = this.getPlaneAltitudes();
LatLon[] locations = this.getPlaneLocations();
Vec4 ll = globe.computePointFromPosition(locations[0].getLatitude(), locations[0].getLongitude(), altitudes[0]);
Vec4 lr = globe.computePointFromPosition(locations[1].getLatitude(), locations[1].getLongitude(), altitudes[0]);
Vec4 ur = globe.computePointFromPosition(locations[1].getLatitude(), locations[1].getLongitude(), altitudes[1]);
Vec4 ul = globe.computePointFromPosition(locations[0].getLatitude(), locations[0].getLongitude(), altitudes[1]);
return new BilinearInterpolator(ll, lr, ur, ul);
}
protected void setStateExpired()
{
this.serialNumber++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -