Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.224, 1.225
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-08-28 07:04:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20300/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: made some changes in the way spaces are drawn Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.224 retrieving revision 1.225 diff -C2 -d -r1.224 -r1.225 *** View.java 20 Aug 2007 12:33:37 -0000 1.224 --- View.java 28 Aug 2007 07:04:47 -0000 1.225 *************** *** 79,82 **** --- 79,85 ---- private static Logger log = Logger.getLogger(View.class); + /** How deep in the struckture there should be drawn */ + private static int drawDepth = Space.SPACE_LEVEL; + private static final boolean DISP = false; *************** *** 430,434 **** * @return The grid size */ ! public static double gridSize() { double size = gridSize; if (adjustGridSize) { --- 433,437 ---- * @return The grid size */ ! private static double gridSize() { double size = gridSize; if (adjustGridSize) { *************** *** 446,450 **** * Set the highlight pattern */ ! public static void setHighlight() { byte b1 = (byte) 0x88; byte b2 = (byte) 0x22; --- 449,453 ---- * Set the highlight pattern */ ! private static void setHighlight() { byte b1 = (byte) 0x88; byte b2 = (byte) 0x22; *************** *** 468,472 **** * Set the seethrough pattern */ ! public static void setSeethrough() { byte b1 = (byte) 0x80; byte b2 = (byte) 0x08; --- 471,475 ---- * Set the seethrough pattern */ ! private static void setSeethrough() { byte b1 = (byte) 0x80; byte b2 = (byte) 0x08; *************** *** 526,530 **** * @param surface Surface */ ! public static void setLastSurface(Surface surface) { lastSurface = surface; } --- 529,533 ---- * @param surface Surface */ ! private static void setLastSurface(Surface surface) { lastSurface = surface; } *************** *** 780,784 **** * The camera setup function */ ! public void initCamera() { if (log.isDebugEnabled()) { log.debug("[display]"); --- 783,787 ---- * The camera setup function */ ! private void initCamera() { if (log.isDebugEnabled()) { log.debug("[display]"); *************** *** 839,843 **** * @param cs the coordinatesystem, */ ! protected void grid(CoordinateSystem cs) { double size = View.gridSize(); gl.glLineWidth(1.0f); --- 842,846 ---- * @param cs the coordinatesystem, */ ! private void grid(CoordinateSystem cs) { double size = View.gridSize(); gl.glLineWidth(1.0f); *************** *** 869,873 **** * @param hitdetection For hitdetection */ ! protected void drawAll(boolean hitdetection) { if (!hitdetection) { drawNormalMode(); --- 872,876 ---- * @param hitdetection For hitdetection */ ! private void drawAll(boolean hitdetection) { if (!hitdetection) { drawNormalMode(); *************** *** 881,885 **** * @return Supporting edges */ ! public Collection<Edge> collectSupportingEdges(Space active) { Collection<Edge> edges = new HashSet<Edge>(); if (active != Project.getInstance().world()) { --- 884,888 ---- * @return Supporting edges */ ! private Collection<Edge> collectSupportingEdges(Space active) { Collection<Edge> edges = new HashSet<Edge>(); if (active != Project.getInstance().world()) { *************** *** 1120,1124 **** transform(space.getTransformations()); if (active) { ! Collection<Surface> surfaces = space.getSurfaces(); switch (drawMode) { case SPACE_ASSGN_MODE: { --- 1123,1140 ---- transform(space.getTransformations()); if (active) { ! Collection<Surface> surfaces = new HashSet<Surface>(); ! for (Space s : space.getElements()) { ! if (s == space.getEmpty()) { ! for (Surface sur : s.getEnvelope()) { ! if (sur.getFrontDomain() == s && sur.getBackDomain() == s) { ! surfaces.add(sur); ! } ! } ! } else { ! if (s.getLevel() <= drawDepth) { ! surfaces.addAll(s.getEnvelope()); ! } ! } ! } switch (drawMode) { case SPACE_ASSGN_MODE: { *************** *** 1136,1146 **** gl.glPolygonOffset(0.5f, 0.5f); gl.glEnable(GL.GL_CULL_FACE); ! gl.glCullFace(GL.GL_BACK); drawSurfaces(surfaces, FRONT); ! gl.glCullFace(GL.GL_FRONT); drawSurfaces(surfaces, BACK); ! gl.glDisable(GL.GL_CULL_FACE); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); --- 1152,1162 ---- gl.glPolygonOffset(0.5f, 0.5f); gl.glEnable(GL.GL_CULL_FACE); ! gl.glCullFace(GL.GL_BACK); drawSurfaces(surfaces, FRONT); ! gl.glCullFace(GL.GL_FRONT); drawSurfaces(surfaces, BACK); ! gl.glDisable(GL.GL_CULL_FACE); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); *************** *** 1166,1173 **** } ! Collection<Space> elements = space.getElements(); ! for (Space current : elements) { ! if (!(current instanceof Net) || Project.getInstance().getActiveSpace() == current) { ! drawSpace(current, active, selected); } } --- 1182,1190 ---- } ! if (space.getLevel() < drawDepth) { ! for (Space current : space.getElements()) { ! if (!(current instanceof Net) || Project.getInstance().getActiveSpace() == current) { ! drawSpace(current, active, selected); ! } } } *************** *** 1213,1216 **** --- 1230,1250 ---- drawSurface(s, false); gl.glDisable(GL.GL_POLYGON_STIPPLE); + } else if (o instanceof Space) { + Space space = (Space)o; + gl.glLineWidth(2.0f); + Collection<Edge> edges = new LinkedList<Edge>(); + edges.addAll(Surface.edges(space.getEnvelope())); + if (edges.isEmpty()) { + edges.addAll(space.getEdges()); + if (edges.isEmpty()) { + for (Space elem : space.getElements()) { + edges.addAll(elem.getEdges()); + } + } + } + for (Edge e : edges) { + drawEdge(e); + } + gl.glLineWidth(1.0f); } else if (o instanceof ClippingPlane) { ClippingPlane cp = (ClippingPlane) o; *************** *** 1544,1548 **** * @param dodge dodge colors */ ! public void drawGeneralEdges(Collection<Edge> edges, boolean dodge) { Collection selection = Selection.primary(); for (Edge current : edges) { --- 1578,1582 ---- * @param dodge dodge colors */ ! private void drawGeneralEdges(Collection<Edge> edges, boolean dodge) { Collection selection = Selection.primary(); for (Edge current : edges) { *************** *** 1581,1585 **** * @param edges The edges */ ! public void drawConstructionEdges(GLAutoDrawable gld, Collection edges) { gl.glLineWidth(1.0f); gl.glColor3fv(constructorColor, 0); --- 1615,1619 ---- * @param edges The edges */ ! private void drawConstructionEdges(GLAutoDrawable gld, Collection edges) { gl.glLineWidth(1.0f); gl.glColor3fv(constructorColor, 0); *************** *** 1721,1725 **** * @param string The string to draw */ ! void drawString(double x, double y, double z, String string) { gl.glPushMatrix(); gl.glRasterPos3d(x, y, z); --- 1755,1759 ---- * @param string The string to draw */ ! private void drawString(double x, double y, double z, String string) { gl.glPushMatrix(); gl.glRasterPos3d(x, y, z); *************** *** 1735,1739 **** * @param string The String */ ! void drawTextBox(double x, double y, double z, String string) { int width = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_12, string); gl.glColor3d(0.85, 0.85, 0.85); --- 1769,1773 ---- * @param string The String */ ! private void drawTextBox(double x, double y, double z, String string) { int width = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_12, string); gl.glColor3d(0.85, 0.85, 0.85); *************** *** 1803,1807 **** * @param clickable if true clicking the labels brings up dialog. */ ! void labelSurface(Surface surface, boolean clickable) { Transformation transformation = transformation(); Vertex from = surface.center(); --- 1837,1841 ---- * @param clickable if true clicking the labels brings up dialog. */ ! private void labelSurface(Surface surface, boolean clickable) { Transformation transformation = transformation(); Vertex from = surface.center(); *************** *** 1932,1936 **** * @param clickable if true clicking the labels brings up dialog. */ ! void labelSelection(boolean clickable) { Collection<Geometric> selection = Selection.primary(); if (selection.size() == 1) { --- 1966,1970 ---- * @param clickable if true clicking the labels brings up dialog. */ ! private void labelSelection(boolean clickable) { Collection<Geometric> selection = Selection.primary(); if (selection.size() == 1) { *************** *** 1966,1987 **** /** - * Compare two doubles to see if they are close enough to - * be considered equal - * @param a A value - * @param b A value - * @return Do they compare? - */ - protected boolean cmp(double a, double b) { - return Math.abs(b - a) < 0.0000001; - } - - /** * Draws the objects for selection */ private void drawSelectionMode() { Space space = Project.getInstance().getActiveSpace(); ! Collection<Surface> surfaces = new LinkedList<Surface>(); ! ! surfaces.addAll(space.getSurfaces()); Collection<Space> elements = space.getElements(); --- 2000,2008 ---- /** * Draws the objects for selection */ private void drawSelectionMode() { Space space = Project.getInstance().getActiveSpace(); ! Collection<Surface> surfaces = new HashSet<Surface>(); Collection<Space> elements = space.getElements(); *************** *** 1989,1992 **** --- 2010,2027 ---- if (element.isUnion()) { surfaces.addAll(element.getSurfaces()); + } else { + if (element == space.getEmpty()) { + for (Surface sur : element.getEnvelope()) { + if (sur.getFrontDomain() == element && sur.getBackDomain() == element) { + surfaces.add(sur); + } + } + } else { + if (element.getSurfaces().isEmpty()) { + surfaces.addAll(element.getEnvelope()); + } else { + surfaces.addAll(element.getSurfaces()); + } + } } } *************** *** 3231,3235 **** * @param glObjects The glObjects to add. */ ! public void addGlObjects3D(Set glObjects) { this.glObjects3D.addAll(glObjects); } --- 3266,3270 ---- * @param glObjects The glObjects to add. */ ! public void addGlObjects3D(Set<? extends GlObject> glObjects) { this.glObjects3D.addAll(glObjects); } |