📄 clearwebgraphicsadapter.java
字号:
package com.esri.solutions.jitk.web.tasks.mapcomp;
import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.WebGraphics;
import com.esri.solutions.jitk.web.tasks.IWebContextAware;
/**
* Clears the graphics on the Map managed in the {@link WebGraphics} object. The
* graphics in WebGraphics will be cleared when a Map Composition is created or
* opened. Only the {@link #created(MapCompositionEvent)} and {@link #opened(MapCompositionEvent)}
* methods are implemented by this class.
*/
public class ClearWebGraphicsAdapter implements IMapCompositionEventObserver {
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.mapcomp.IMapCompositionEventObserver#created(com.esri.solutions.jitk.web.tasks.mapcomp.MapCompositionEvent)
*/
public void created(MapCompositionEvent event) {
if (event.getSource() instanceof IWebContextAware) {
IWebContextAware ctxAware = (IWebContextAware) event.getSource();
WebContext ctx = ctxAware.getContext();
WebGraphics graphics = ctx.getWebGraphics();
clearGraphics(graphics);
}
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.mapcomp.IMapCompositionEventObserver#deleted(com.esri.solutions.jitk.web.tasks.mapcomp.MapCompositionEvent)
*/
public void deleted(MapCompositionEvent event) {
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.mapcomp.IMapCompositionEventObserver#opened(com.esri.solutions.jitk.web.tasks.mapcomp.MapCompositionEvent)
*/
public void opened(MapCompositionEvent event) {
if (event.getSource() instanceof IWebContextAware) {
IWebContextAware ctxAware = (IWebContextAware) event.getSource();
WebContext ctx = ctxAware.getContext();
WebGraphics graphics = ctx.getWebGraphics();
clearGraphics(graphics);
}
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.mapcomp.IMapCompositionEventObserver#saved(com.esri.solutions.jitk.web.tasks.mapcomp.MapCompositionEvent)
*/
public void saved(MapCompositionEvent event) {
}
/**
* Clears the graphics within the {@link WebGraphics} object in the
* {@link WebContext}.
*
* @param graphics Reference to {@link WebGraphics}.
*/
private void clearGraphics(WebGraphics graphics) {
if (graphics != null) {
graphics.clearGraphics();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -