update dev300-m58
[ooovba.git] / canvas / source / java / LinePolyPolygon.java
blob6515d345f0b7a8fbfb28aa4c6ddf51ffe4ca5f17
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: LinePolyPolygon.java,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // Canvas
32 import com.sun.star.rendering.*;
33 import com.sun.star.geometry.*;
35 public class LinePolyPolygon
36 extends com.sun.star.lib.uno.helper.ComponentBase
37 implements com.sun.star.lang.XServiceInfo,
38 com.sun.star.rendering.XLinePolyPolygon2D
40 private java.awt.geom.GeneralPath path;
42 //----------------------------------------------------------------------------------
44 public LinePolyPolygon( RealPoint2D[][] points )
46 setPoints( points, 0 );
49 public java.awt.geom.GeneralPath getJavaPath()
51 return path;
54 //----------------------------------------------------------------------------------
57 // XPolyPolygon implementation
58 // ===========================
60 public synchronized void addPolyPolygon( RealPoint2D position, XPolyPolygon2D polyPolygon )
64 public synchronized int getNumberOfPolygons( )
66 return 0;
69 public synchronized int getNumberOfPolygonPoints( int polygon )
71 return 0;
74 public synchronized FillRule getFillRule( )
76 if( path.getWindingRule() == java.awt.geom.GeneralPath.WIND_EVEN_ODD )
77 return FillRule.EVEN_ODD;
78 else
79 return FillRule.NON_ZERO;
82 public synchronized void setFillRule( FillRule fillRule )
84 if( fillRule == FillRule.EVEN_ODD )
85 path.setWindingRule( java.awt.geom.GeneralPath.WIND_EVEN_ODD );
86 else
87 path.setWindingRule( java.awt.geom.GeneralPath.WIND_NON_ZERO );
90 public synchronized boolean isClosed( int index )
92 // TODO
93 return false;
96 public synchronized void setClosed( int index, boolean closedState )
98 // TODO
101 //----------------------------------------------------------------------------------
104 // XLinePolyPolygon implementation
105 // ===============================
107 public synchronized RealPoint2D[][] getPoints( int nPolygonIndex, int nNumberOfPolygons, int nPointIndex, int nNumberOfPoints )
109 // TODO: Implement subsetting
111 // double [] points = new double[6];
113 // // BAH! Use util.Vector here!
115 // // find number of subpaths
116 // PathIterator aIter = path.getPathIterator( new AffineTransform() );
117 // int nNumSubPaths = 0;
118 // while( !aIter.isDone() )
119 // {
120 // if( aIter.currentSegment(points) == SEG_MOVETO )
121 // ++nNumSubPaths;
123 // aIter.next();
124 // }
126 // Point2D [][] aRes = new Point2D[nNumSubPaths][];
127 // aIter = path.getPathIterator( new AffineTransform() );
128 // while( !aIter.isDone() )
129 // {
130 // switch( aIter.currentSegment(points) )
131 // {
132 // case SEG_MOVETO:
133 // break;
135 // case SEG_LINETO:
136 // break;
138 // case SEG_CLOSE:
139 // break;
141 // default:
142 // CanvasUtils.printLog( "LinePolyPolygon.getPoints(): unexpected path type" );
143 // break;
144 // }
146 // aIter.next();
147 // }
148 // double [] points = new double[6];
150 return null;
153 public synchronized void setPoints( RealPoint2D[][] points, int nPolygonIndex )
155 if( nPolygonIndex != 0 )
156 CanvasUtils.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" );
158 path = CanvasUtils.makeGenPathFromLinePoints( points );
161 public synchronized RealPoint2D getPoint( int nPolygonIndex, int nPointIndex )
163 return null;
166 public synchronized void setPoint( RealPoint2D point, int nPolygonIndex, int nPointIndex )
168 CanvasUtils.printLog( "LinePolyPolygon.setPoint: not yet implemented!" );
171 //----------------------------------------------------------------------------------
174 // XServiceInfo impl
175 // =================
178 private static final String s_implName = "XLinePolyPolygon2D.java.impl";
179 private static final String s_serviceName = "com.sun.star.rendering.LinePolyPolygon2D";
181 public String getImplementationName()
183 return s_implName;
186 public String [] getSupportedServiceNames()
188 return new String [] { s_serviceName };
191 public boolean supportsService( String serviceName )
193 return serviceName.equals( s_serviceName );