⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omgraphiclist.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * @see OMGeometry#setAppObject     * @see OMGeometry#getAppObject     */    protected synchronized OMGeometry _getWithAppObject(Object appObj) {        for (Iterator it = graphics.iterator(); it.hasNext();) {            OMGeometry graphic = (OMGeometry) it.next();            Object tObj = graphic.getAppObject();            if ((appObj == tObj) || (appObj.equals(tObj))) {                return (OMGeometry) graphic;            }            // For this object, if it is an OMGraphicList and is            // not vague, check its OMGraphics for their app            // objects, too.            if (graphic instanceof OMGraphicList                    && !((OMGraphicList) graphic).isVague()) {                OMGraphicList omgl = (OMGraphicList) graphic;                OMGeometry tGeom = omgl.getOMGraphicWithAppObject(appObj);                if (tGeom != null) {                    return tGeom;                }            }        }        return null;    }    /**     * Remove the graphic at the location number.     *      * @param location the location of the OMGraphic to remove.     */    public void removeOMGraphicAt(int location) {        _remove(location);    }    /**     * Remove the graphic.     *      * @param graphic the OMGraphic object to remove.     * @return true if graphic was on the list, false if otherwise.     */    public boolean remove(OMGraphic graphic) {        return _remove(graphic);    }    /**     * Remove the graphic at a location in the list.     *      * @param location the OMGraphic object to remove.     * @return true if graphic was on the list, false if otherwise.     */    protected synchronized Object _remove(int location) {        return graphics.remove(location);    }    /**     * Remove the graphic. If this list is not vague, it will also ask     * sub-OMGraphicLists to remove it if the geometry isn't found on this     * OMGraphicList.     *      * @param geometry the OMGeometry object to remove.     * @return true if geometry was on the list, false if otherwise.     */    protected synchronized boolean _remove(OMGeometry geometry) {        boolean found = false;        found = graphics.remove(geometry);        if (!found && !isVague()) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                OMGraphic graphic = (OMGraphic) it.next();                if (graphic instanceof OMGraphicList) {                    found = ((OMGraphicList) graphic)._remove(geometry);                }            }        }        return found;    }    /**     * Return the index of the OMGraphic in the list.     *      * @param graphic the graphic to look for     * @return the index in the list of the graphic, -1 if the object is not     *         found.     */    public int indexOf(OMGraphic graphic) {        return _indexOf(graphic);    }    /**     * Return the index of the OMGeometry in the list.     *      * @param geometry the geometry to look for     * @return the index in the list of the geometry, -1 if the object is not     *         found.     */    protected synchronized int _indexOf(OMGeometry geometry) {        return graphics.indexOf(geometry);    }    /**     * Insert the graphic at the location number. The OMGraphic must not be     * null.     *      * @param graphic the OMGraphic to insert.     * @param location the location of the OMGraphic to insert     * @exception IllegalArgumentException if OMGraphic is null     * @exception ArrayIndexOutOfBoundsException if index is out-of-bounds     */    public void insertOMGraphicAt(OMGraphic graphic, int location) {        _insert(graphic, location);    }    /**     * Insert the geometry at the location number. The OMGeometry must not be     * null.     *      * @param geometry the OMGeometry to insert.     * @param location the location of the OMGeometry to insert     * @exception IllegalArgumentException if OMGeometry is null     * @exception ArrayIndexOutOfBoundsException if index is out-of-bounds     */    protected synchronized void _insert(OMGeometry geometry, int location) {        graphics.add(location, geometry);    }    /**     * Moves the graphic at the given index to the part of the list where it     * will be drawn on top of one of the other graphics which is its neighbor     * on the list. This method does check to see what the traverseMode of the     * list is, and calls either moveIndexedToLast or moveIndexedToFirst,     * depending on what is appropriate.     *      * @param location the index location of the graphic to move.     * @see #moveIndexedOneToFront(int)     * @see #moveIndexedOneToBack(int)     */    public void moveIndexedOneToTop(int location) {        if (traverseMode == FIRST_ADDED_ON_TOP) {            moveIndexedOneToFront(location);        } else {            moveIndexedOneToBack(location);        }    }    /**     * Moves the graphic at the given index to the part of the list where it     * will be drawn on top of the other graphics. This method does check to see     * what the traverseMode of the list is, and calls either moveIndexedToLast     * or moveIndexedToFirst, depending on what is appropriate.     *      * @param location the index location of the graphic to move.     */    public void moveIndexedToTop(int location) {        if (traverseMode == FIRST_ADDED_ON_TOP) {            moveIndexedToFirst(location);        } else {            moveIndexedToLast(location);        }    }    /**     * Moves the graphic at the given index to the part of the list where it     * will be drawn under one of the other graphics, its neighbor on the list.     * This method does check to see what the traverseMode of the list is, and     * calls either moveIndexedOneToBack or moveIndexedOneToFront, depending on     * what is appropriate.     *      * @param location the index location of the graphic to move.     * @see #moveIndexedOneToFront(int)     * @see #moveIndexedOneToBack(int)     */    public void moveIndexedOneToBottom(int location) {        if (traverseMode == FIRST_ADDED_ON_TOP) {            moveIndexedOneToBack(location);        } else {            moveIndexedOneToFront(location);        }    }    /**     * Moves the graphic at the given index to the part of the list where it     * will be drawn under all of the other graphics. This method does check to     * see what the traverseMode of the list is, and calls either     * moveIndexedToLast or moveIndexedToFirst, depending on what is     * appropriate.     *      * @param location the index location of the graphic to move.     */    public void moveIndexedToBottom(int location) {        if (traverseMode == FIRST_ADDED_ON_TOP) {            moveIndexedToLast(location);        } else {            moveIndexedToFirst(location);        }    }    /**     * Moves the graphic at the given index to the front of the list, sliding     * the other graphics back on in the list in order. If the location is     * already at the beginning or beyond the end, nothing happens.     *      * @param location the index of the graphic to move.     * @see #moveIndexedToBottom(int)     * @see #moveIndexedToTop(int)     */    public void moveIndexedToFirst(int location) {        int listSize = size();        if (location > 0 && location < listSize) {            OMGeometry tmpGraphic = _getAt(location);            for (int i = location; i > 0; i--) {                _setAt(_getAt(i - 1), i);            }            _setAt(tmpGraphic, 0);        }    }    /**     * Moves the graphic at the given index toward the front of the list by one     * spot, sliding the other graphic back on in the list in order. If the     * location is already at the beginning or beyond the end, nothing happens.     *      * @param location the index of the graphic to move.     */    public void moveIndexedOneToFront(int location) {        int listSize = size();        if (location > 0 && location < listSize) {            OMGeometry tmpGraphic = _getAt(location);            _setAt(_getAt(location - 1), location);            _setAt(tmpGraphic, location - 1);        }    }    /**     * Moves the graphic at the given index to the end of the list, sliding the     * other graphics up on in the list in order. If the location is already at     * the end or less than zero, nothing happens.     *      * @param location the index of the graphic to move.     * @see #moveIndexedToBottom(int)     * @see #moveIndexedToTop(int)     */    public void moveIndexedToLast(int location) {        int listSize = size();        if (location < listSize - 1 && location >= 0) {            OMGeometry tmpGraphic = _getAt(location);            for (int i = location; i < listSize - 1; i++) {                _setAt(_getAt(i + 1), i);            }            _setAt(tmpGraphic, listSize - 1);        }    }    /**     * Moves the graphic at the given index toward the back of the list by one     * spot, sliding the other graphic up on in the list in order. If the     * location is already at the end or less than zero, nothing happens.     *      * @param location the index of the graphic to move.     */    public void moveIndexedOneToBack(int location) {        int listSize = size();        if (location < listSize - 1 && location >= 0) {            OMGeometry tmpGraphic = _getAt(location);            _setAt(_getAt(location + 1), location);            _setAt(tmpGraphic, location + 1);        }    }    /**     * Set the stroke of all the graphics on the list.     *      * @param stroke the stroke object to use.     */    public void setStroke(java.awt.Stroke stroke) {        super.setStroke(stroke);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setStroke(stroke);            }        }    }    /**     * Set the fill paint for all the objects on the list.     *      * @param paint java.awt.Paint     */    public void setFillPaint(Paint paint) {        super.setFillPaint(paint);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setFillPaint(paint);            }        }    }    /**     * Set the texture mask for the OMGraphics on the list. If not null, then it     * will be rendered on top of the fill paint. If the fill paint is clear,     * the texture mask will not be used. If you just want to render the texture     * mask as is, set the fill paint of the graphic instead. This is really to     * be used to have a texture added to the graphic, with the fill paint still     * influencing appearance.     */    public void setTextureMask(TexturePaint texture) {        super.setTextureMask(texture);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setTextureMask(texture);            }        }    }    /**     * Set the line paint for all the objects on the list.     *      * @param paint java.awt.Paint     */    public void setLinePaint(Paint paint) {        super.setLinePaint(paint);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setLinePaint(paint);            }        }    }    /**     * Set the selection paint for all the objects on the list.     *      * @param paint java.awt.Paint     */    public void setSelectPaint(Paint paint) {        super.setSelectPaint(paint);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setSelectPaint(paint);            }        }    }    /**     * Set the matting paint for all the objects on the list.     *      * @param paint java.awt.Paint     */    public void setMattingPaint(Paint paint) {        super.setMattingPaint(paint);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setMattingPaint(paint);            }        }    }    /**     * Set the matting flag for all the objects on the list.     */    public void setMatted(boolean value) {        super.setMatted(value);        synchronized (this) {            for (Iterator it = graphics.iterator(); it.hasNext();) {                ((OMGraphic) it.next()).setMatted(value);            }        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -