📄 segmentplaneattributes.java
字号:
/* Copyright (C) 2001, 2008 United States Government as represented by
the Administrator of the National Aeronautics and Space Administration.
All Rights Reserved.
*/
package gov.nasa.worldwind.render;
import gov.nasa.worldwind.avlist.*;
import gov.nasa.worldwind.geom.*;
import gov.nasa.worldwind.util.Logging;
import javax.media.opengl.GL;
import java.awt.*;
import java.util.*;
/**
* @author dcollins
* @version $Id: SegmentPlaneAttributes.java 9459 2009-03-18 00:32:45Z dcollins $
*/
public class SegmentPlaneAttributes
{
public static class GeometryAttributes
{
private boolean visible;
private Material material;
private double opacity;
private double size;
private double pickSize;
private Vec4 offset;
public GeometryAttributes(Material material, double opacity)
{
if (material == null)
{
String message = Logging.getMessage("nullValue.MaterialIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (opacity < 0.0 || opacity > 1.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "opacity < 0 or opacity > 1");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.visible = true;
this.material = material;
this.opacity = opacity;
this.size = 1.0;
this.pickSize = 1.0;
this.offset = Vec4.ZERO;
}
public GeometryAttributes()
{
this(Material.WHITE, 1.0);
}
public GeometryAttributes copy()
{
return this.copyTo(new GeometryAttributes());
}
public GeometryAttributes copyTo(GeometryAttributes copy)
{
copy.setVisible(this.isVisible());
copy.setMaterial(this.getMaterial());
copy.setOpacity(this.getOpacity());
copy.setSize(this.getSize());
copy.setPickSize(this.getPicksize());
copy.setOffset(this.getOffset());
return copy;
}
public boolean isVisible()
{
return visible;
}
public void setVisible(boolean visible)
{
this.visible = visible;
}
public Material getMaterial()
{
return this.material;
}
public void setMaterial(Material material)
{
if (material == null)
{
String message = Logging.getMessage("nullValue.MaterialIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.material = material;
}
public double getOpacity()
{
return this.opacity;
}
public void setOpacity(double opacity)
{
if (opacity < 0.0 || opacity > 1.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "opacity < 0 or opacity > 1");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.opacity = opacity;
}
public double getSize()
{
return this.size;
}
public void setSize(double size)
{
if (size < 0.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "size < 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.size = size;
}
public double getPicksize()
{
return this.pickSize;
}
public void setPickSize(double size)
{
if (size < 0.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "size < 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.pickSize = size;
}
public Vec4 getOffset()
{
return this.offset;
}
public void setOffset(Vec4 vec4)
{
if (vec4 == null)
{
String message = Logging.getMessage("nullValue.Vec4IsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.offset = vec4;
}
}
public static class LabelAttributes
{
private boolean visible;
private java.awt.Color color;
private java.awt.Font font;
private String horizontalAlignment;
private String verticalAlignment;
private double minActiveDistance;
private double maxActiveDistance;
private Vec4 offset;
public LabelAttributes(Color color, Font font, String horizontalAlignment, String verticalAlignment)
{
if (color == null)
{
String message = Logging.getMessage("nullValue.ColorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (font == null)
{
String message = Logging.getMessage("nullValue.FontIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (horizontalAlignment == null)
{
String message = Logging.getMessage("nullValue.HorizontalAlignmentIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (verticalAlignment == null)
{
String message = Logging.getMessage("nullValue.VerticalAlignmentIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.visible = true;
this.color = color;
this.font = font;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
this.minActiveDistance = 0;
this.maxActiveDistance = Double.MAX_VALUE;
this.offset = Vec4.ZERO;
}
public LabelAttributes()
{
this(Color.WHITE, Font.decode("Arial-12"), AVKey.LEFT, AVKey.BOTTOM);
}
public LabelAttributes copy()
{
return this.copyTo(new LabelAttributes());
}
protected LabelAttributes copyTo(LabelAttributes copy)
{
copy.setVisible(this.isVisible());
copy.setColor(this.getColor());
copy.setFont(this.getFont());
copy.setHorizontalAlignment(this.getHorizontalAlignment());
copy.setVerticalAlignment(this.getVerticalAlignment());
copy.setMinActiveDistance(this.getMinActiveDistance());
copy.setMaxActiveDistance(this.getMaxActiveDistance());
copy.setOffset(this.getOffset());
return copy;
}
public boolean isVisible()
{
return this.visible;
}
public void setVisible(boolean visible)
{
this.visible = visible;
}
public Color getColor()
{
return this.color;
}
public void setColor(Color color)
{
if (color == null)
{
String message = Logging.getMessage("nullValue.ColorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.color = color;
}
public Font getFont()
{
return this.font;
}
public void setFont(Font font)
{
if (font == null)
{
String message = Logging.getMessage("nullValue.FontIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.font = font;
}
public String getHorizontalAlignment()
{
return this.horizontalAlignment;
}
public void setHorizontalAlignment(String horizontalAlignment)
{
if (horizontalAlignment == null)
{
String message = Logging.getMessage("nullValue.HorizontalAlignmentIsNull");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -