svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.editing.app / org.gvsig.editing.app.mainplugin / src / main / java / org / gvsig / editing / gui / cad / tools / split / SplitGraphNode.java @ 40557
History | View | Annotate | Download (3.17 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/* Spatial Operations & Editing Tools for uDig
|
25 |
*
|
26 |
* Axios Engineering under a funding contract with:
|
27 |
* Diputación Foral de Gipuzkoa, Ordenación Territorial
|
28 |
*
|
29 |
* http://b5m.gipuzkoa.net
|
30 |
* http://www.axios.es
|
31 |
*
|
32 |
* (C) 2006, Diputación Foral de Gipuzkoa, Ordenación Territorial (DFG-OT).
|
33 |
* DFG-OT agrees to licence under Lesser General Public License (LGPL).
|
34 |
*
|
35 |
* You can redistribute it and/or modify it under the terms of the
|
36 |
* GNU Lesser General Public License as published by the Free Software
|
37 |
* Foundation; version 2.1 of the License.
|
38 |
*
|
39 |
* This library is distributed in the hope that it will be useful,
|
40 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
41 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
42 |
* Lesser General Public License for more details.
|
43 |
*/
|
44 |
package org.gvsig.editing.gui.cad.tools.split; |
45 |
|
46 |
import com.vividsolutions.jts.geom.Coordinate; |
47 |
import com.vividsolutions.jts.geomgraph.DirectedEdge; |
48 |
import com.vividsolutions.jts.geomgraph.EdgeEnd; |
49 |
import com.vividsolutions.jts.geomgraph.Node; |
50 |
|
51 |
/**
|
52 |
* Custom node type. Does nothing special by now but to force the use of {@link SplitEdgeStar}
|
53 |
* instances as the node's list of incident edges and allow to remove edges from its list of
|
54 |
* incident edges.
|
55 |
*
|
56 |
* @author Gabriel Roldán, Axios Engineering
|
57 |
* @author Mauricio Pazos, Axios Engineering
|
58 |
* @since 1.1.0
|
59 |
*/
|
60 |
class SplitGraphNode extends Node { |
61 |
public SplitGraphNode( Coordinate coord, SplitEdgeStar incidentEdges ) {
|
62 |
super(coord, incidentEdges);
|
63 |
} |
64 |
|
65 |
public void add( DirectedEdge edge ) { |
66 |
super.add(edge);
|
67 |
} |
68 |
|
69 |
@Override
|
70 |
public void add( EdgeEnd edge ) { |
71 |
add((DirectedEdge) edge); |
72 |
} |
73 |
|
74 |
/**
|
75 |
* Removes the given <code>edge</code> from this node's {@link #getEdges() edge list}.
|
76 |
*
|
77 |
* @param edge
|
78 |
*/
|
79 |
public void remove( DirectedEdge edge ) { |
80 |
SplitEdgeStar edges = (SplitEdgeStar) getEdges(); |
81 |
edges.remove(edge); |
82 |
} |
83 |
|
84 |
public String toString() { |
85 |
StringBuffer sb = new StringBuffer("Node["); |
86 |
sb.append(coord.x).append(":").append(coord.y);
|
87 |
sb.append(", ").append(label);
|
88 |
sb.append(", ").append(getEdges());
|
89 |
sb.append("]");
|
90 |
return sb.toString();
|
91 |
} |
92 |
} |