本文整理汇总了Java中gov.nasa.worldwind.layers.LayerList.add方法的典型用法代码示例。如果您正苦于以下问题:Java LayerList.add方法的具体用法?Java LayerList.add怎么用?Java LayerList.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.layers.LayerList
的用法示例。
在下文中一共展示了LayerList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addOverlay
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
@Override
public void addOverlay( String name, Overlay overlay, int index, String infoURLString, boolean fireChange, XML_Menu xml_item) {
super.addOverlay(name, overlay, index, infoURLString, fireChange, xml_item);
if (overlay instanceof WWOverlay) {
WWOverlay wwOverlay = (WWOverlay)overlay;
Layer layer = wwOverlay.getLayer();
if (layer instanceof WWLayer)
((WWLayer) layer).setInfoURL(infoURLString);
LayerList layers = wwd.getModel().getLayers();
if (layers.contains(layer)) return;
layers.add( layer );
wwd.addSelectListener( wwOverlay.getSelectListener() );
}
}
示例2: makeLayerVisible
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public synchronized void makeLayerVisible(Layer newLayer, boolean ignoreLayer) {
if (newLayer == null) return;
if (ignoreLayer)
layerManager.addIgnoredLayer(newLayer);
LayerList ll = wwModel.getLayers();
newLayer.setEnabled(true);
if (newLayer.getOpacity() < .3)
newLayer.setOpacity(1);
ll.remove(newLayer);
ll.add(ll.size(), newLayer);
if (!ignoreLayer)
setLayerManagerVisible(true);
}
示例3: enable
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public void enable() {
this.getShape().setStartPosition(null);
LayerList layers = this.getWwd().getModel().getLayers();
if (!layers.contains(this.getLayer()))
layers.add(this.getLayer());
if (!this.getLayer().isEnabled())
this.getLayer().setEnabled(true);
this.setArmed(true);
this.getWwd().addRenderingListener(this);
this.getWwd().addSelectListener(this);
this.getWwd().getInputHandler().addMouseListener(this);
this.getWwd().getInputHandler().addMouseMotionListener(this);
this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
}
示例4: enable
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public void enable() {
// Clear any existing selection and clear set the SceneController's pick
// rectangle. This ensures that this
// ScreenSelector starts with the correct state when enabled.
this.selectionRect.clearSelection();
this.getWwd().getSceneController().setPickRectangle(null);
// Add and enable the layer that displays this ScreenSelector's
// selection rectangle.
LayerList layers = this.getWwd().getModel().getLayers();
if (!layers.contains(this.getLayer()))
layers.add(this.getLayer());
if (!this.getLayer().isEnabled())
this.getLayer().setEnabled(true);
// Listen for mouse input on the World Window.
this.getWwd().getInputHandler().addMouseListener(this);
this.getWwd().getInputHandler().addMouseMotionListener(this);
}
示例5: getValidLayers
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
private LayerList getValidLayers() {
final LayerList validLayers = new LayerList();
final LayerList allLayers = wwd.getModel().getLayers();
for (Layer l : allLayers) {
if (l.getName().equalsIgnoreCase("Atmosphere") || l.getName().equalsIgnoreCase("World Map") ||
l.getName().equalsIgnoreCase("Scale bar") || l.getName().equalsIgnoreCase("Compass") ||
l.getName().equalsIgnoreCase("NASA Blue Marble Image"))
continue;
if (l.getName().equalsIgnoreCase("MS Bing Aerial"))
virtualEarthAerialLayer = l;
else if (l.getName().equalsIgnoreCase("MS Bing Roads"))
virtualEarthRoadsLayer = l;
else if (l.getName().equalsIgnoreCase("MS Bing Hybrid"))
virtualEarthHybridLayer = l;
validLayers.add(l);
}
return validLayers;
}
示例6: insertBeforePlacenames
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public static void insertBeforePlacenames(WorldWindow wwd, Layer layer)
{
// Insert the layer into the layer list just before the placenames.
int compassPosition = 0;
LayerList layers = wwd.getModel().getLayers();
for (Layer l : layers)
{
if (l instanceof PlaceNameLayer)
compassPosition = layers.indexOf(l);
}
layers.add(compassPosition, layer);
}
示例7: insertBeforeCompass
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public static void insertBeforeCompass(WorldWindow wwd, Layer layer)
{
// Insert the layer into the layer list just before the compass.
int compassPosition = 0;
LayerList layers = wwd.getModel().getLayers();
for (Layer l : layers)
{
if (l instanceof CompassLayer)
compassPosition = layers.indexOf(l);
}
layers.add(compassPosition, layer);
}
示例8: insertBeforeCompass
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
/**
* Insert the layer into the layer list just before the compass.
*
* @param wwd
* @param newWWLayer
* @return
*/
private static TVIMap3Layer insertBeforeCompass(final WorldWindow wwd, final TVIMap3Layer newUILayer) {
/*
* update WW model
*/
int compassPosition = 0;
final LayerList wwLayers = wwd.getModel().getLayers();
for (final Layer wwLayer : wwLayers) {
if (wwLayer instanceof CompassLayer) {
compassPosition = wwLayers.indexOf(wwLayer);
}
}
final Layer newWWLayer = newUILayer.wwLayer;
wwLayers.add(compassPosition, newWWLayer);
// update ww layer visibility
newWWLayer.setEnabled(newUILayer.isLayerVisible);
/*
* update UI model
*/
final TVIMap3Layer insertedUILayer = insertBeforeCompass_10(_uiRootItem, newUILayer);
return insertedUILayer;
}
示例9: insertBeforePlaceNames
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
/**
* Insert the layer into the layer list just before the placenames.
*
* @param wwd
* @param newWWLayer
* @return
*/
private static TVIMap3Layer insertBeforePlaceNames(final WorldWindow wwd, final TVIMap3Layer newUILayer) {
/*
* update WW model
*/
int compassPosition = 0;
final LayerList wwLayers = wwd.getModel().getLayers();
for (final Layer wwLayer : wwLayers) {
if (wwLayer instanceof PlaceNameLayer) {
compassPosition = wwLayers.indexOf(wwLayer);
}
}
final Layer newWWLayer = newUILayer.wwLayer;
wwLayers.add(compassPosition, newWWLayer);
// update ww layer visibility
newWWLayer.setEnabled(newUILayer.isLayerVisible);
/*
* update UI model
*/
final TVIMap3Layer insertedUILayer = insertBeforePlaceNames_10(_uiRootItem, newUILayer);
return insertedUILayer;
}
示例10: insertBeforeCompass
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
/**
* Insert a layer before the compass layer.
*
* @param wwd the {@link WorldWindow}.
* @param layer the layer to insert.
*/
public static void insertBeforeCompass( WorldWindow wwd, Layer layer ) {
// Insert the layer into the layer list just before the compass.
int compassPosition = 0;
LayerList layers = wwd.getModel().getLayers();
for( Layer l : layers ) {
if (l instanceof CompassLayer)
compassPosition = layers.indexOf(l);
}
layers.add(compassPosition, layer);
}
示例11: moveLayer
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
protected void moveLayer(WorldWindow wwd, Layer layer, int direction)
{
// Moves the layer associated with this instance in the direction indicated relative to the other layers.
int index = this.findLayerPosition(wwd, layer);
if (index < 0)
return; // layer not found
LayerList layerList = wwd.getModel().getLayers();
this.upButton.setEnabled(true);
this.downButton.setEnabled(true);
if (direction < 0 && index == 0) // can't move lowest layer any lower
{
this.upButton.setEnabled(false);
return;
}
if (direction > 0 && index == layerList.size() - 1) // can't move highest layer any higher
{
this.downButton.setEnabled(false);
return;
}
// Remove the layer from the layer list and then re-insert it.
layerList.remove(layer);
if (direction > 0)
layerList.add(index + 1, layer);
else if (direction < 0)
layerList.add(index - 1, layer);
// Update WorldWind so the change is visible.
wwd.redraw();
}
示例12: drag
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
@Override
protected void drag(SelectEvent event) {
if (event.getEventAction().equals(SelectEvent.DRAG)) {
if ((this.isComponentDragEnabled() && getSelectedIndex() == -1 && this.dragRefIndex == -1)
|| this.draggingComponent) {
// Dragging the whole list
if (!this.draggingComponent) {
this.dragRefCursorPoint = event.getMouseEvent().getPoint();
this.dragRefPoint = getAnnotation().getScreenPoint();
this.draggingComponent = true;
}
final Point cursorOffset = new Point(event.getMouseEvent().getPoint().x - this.dragRefCursorPoint.x,
event.getMouseEvent().getPoint().y - this.dragRefCursorPoint.y);
final Point targetPoint = new Point(this.dragRefPoint.x + cursorOffset.x,
this.dragRefPoint.y - cursorOffset.y);
this.moveTo(targetPoint);
} else if (this.isLayerDragEnabled()) {
// Dragging a layer inside the list
if (!this.draggingLayer) {
this.dragRefIndex = getSelectedIndex();
this.draggingLayer = true;
}
if (getSelectedIndex() != -1 && this.dragRefIndex != -1 && this.dragRefIndex != getSelectedIndex()) {
// Move dragged layer
final LayerList layers = getValidLayers();
final int insertIndex = this.dragRefIndex > getSelectedIndex() ?
getSelectedIndex() : getSelectedIndex() + 1;
final int removeIndex = this.dragRefIndex > getSelectedIndex() ?
this.dragRefIndex + 1 : this.dragRefIndex;
layers.add(insertIndex, layers.get(this.dragRefIndex));
layers.remove(removeIndex);
this.dragRefIndex = getSelectedIndex();
}
}
} else if (event.getEventAction().equals(SelectEvent.DRAG_END)) {
this.draggingComponent = false;
this.draggingLayer = false;
this.dragRefIndex = -1;
}
}
示例13: insertTiledLayer
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
private static void insertTiledLayer(final WorldWindow wwd, final Layer layer) {
int position = 0;
final LayerList layers = wwd.getModel().getLayers();
for (Layer l : layers) {
if (l instanceof PlaceNameLayer) {
position = layers.indexOf(l);
break;
}
}
layers.add(position, layer);
}
示例14: insertBeforePlacenames
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
public static void insertBeforePlacenames(WorldWindow wwd, Layer layer){
// Insert the layer into the layer list just before the placenames.
int compassPosition = 0;
LayerList layers = wwd.getModel().getLayers();
for (Layer l : layers)
{
if (l instanceof PlaceNameLayer)
compassPosition = layers.indexOf(l);
}
layers.add(compassPosition, layer);
}
示例15: drag
import gov.nasa.worldwind.layers.LayerList; //导入方法依赖的package包/类
protected void drag(SelectEvent event)
{
if (event.getEventAction().equals(SelectEvent.DRAG))
{
if ((this.isComponentDragEnabled() && this.selectedIndex == -1 && this.dragRefIndex == -1)
|| this.draggingComponent)
{
// Dragging the whole list
if (!this.draggingComponent)
{
this.dragRefCursorPoint = event.getMouseEvent().getPoint();
this.dragRefPoint = this.annotation.getScreenPoint();
this.draggingComponent = true;
}
Point cursorOffset = new Point(event.getMouseEvent().getPoint().x - this.dragRefCursorPoint.x,
event.getMouseEvent().getPoint().y - this.dragRefCursorPoint.y);
Point targetPoint = new Point(this.dragRefPoint.x + cursorOffset.x,
this.dragRefPoint.y - cursorOffset.y);
this.moveTo(targetPoint);
}
else if (this.isLayerDragEnabled())
{
// Dragging a layer inside the list
if (!this.draggingLayer)
{
this.dragRefIndex = this.selectedIndex;
this.draggingLayer = true;
}
if (this.selectedIndex != -1 && this.dragRefIndex != -1 && this.dragRefIndex != this.selectedIndex)
{
// Move dragged layer
LayerList layers = this.wwd.getModel().getLayers();
int insertIndex = this.dragRefIndex > this.selectedIndex ?
this.selectedIndex : this.selectedIndex + 1;
int removeIndex = this.dragRefIndex > this.selectedIndex ?
this.dragRefIndex + 1 : this.dragRefIndex;
layers.add(insertIndex, layers.get(this.dragRefIndex));
layers.remove(removeIndex);
this.dragRefIndex = this.selectedIndex;
}
}
}
else if (event.getEventAction().equals(SelectEvent.DRAG_END))
{
this.draggingComponent = false;
this.draggingLayer = false;
this.dragRefIndex = -1;
}
}