Examples of GridStyle


Examples of net.sf.latexdraw.glib.ui.LMagneticGrid.GridStyle

    update();
  }


  protected void update() {
    final GridStyle style = grid.getStyle();
    final boolean visible = style!=GridStyle.NONE;

    composer.setWidgetVisible(gridSpacing, visible && style==GridStyle.CUSTOMISED);
    composer.setWidgetVisible(magneticCB, visible);
    styleList.setSelectedItemSafely(style.getLabel());

    if(visible) {
      if(style==GridStyle.CUSTOMISED)
        gridSpacing.setValueSafely(grid.getGridSpacing());
      magneticCB.setSelected(grid.isMagnetic());
View Full Code Here

Examples of net.sf.latexdraw.glib.ui.LMagneticGrid.GridStyle

    final ScaleRulersCustomiser scaleCust   = frame.getScaleRulersCustomiser();
    final FileLoaderSaver saver       = frame.getFileLoader();
    final LCanvas canvas          = frame.getCanvas();
    final Dimension dim           = LSystem.INSTANCE.getScreenDimension();
    final Rectangle rec           = frame.getGraphicsConfiguration().getBounds();
    final GridStyle gridStyle;

    if(displayGridCB.isSelected())
       gridStyle = classicGridRB.isSelected() ? GridStyle.STANDARD : GridStyle.CUSTOMISED;
    else gridStyle = GridStyle.NONE;

    gridCust.grid.setStyle(gridStyle);
    gridCust.grid.setMagnetic(magneticGridCB.isSelected());
    gridCust.grid.setGridSpacing(Integer.parseInt(persoGridGapField.getValue().toString()));
    canvas.setAlphaInterpolation(alpaInterCheckBox.isSelected() ? RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY : RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
    canvas.setAntiAliasing(antialiasingCheckBox.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
    canvas.setColorRendering(colorRenderCheckBox.isSelected() ? RenderingHints.VALUE_COLOR_RENDER_QUALITY : RenderingHints.VALUE_COLOR_RENDER_SPEED);
    canvas.setRendering(renderingCheckBox.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED);
    exporter.setDefaultPackages(latexIncludes.getText());
    exporter.setPathExport(pathExportField.getText());
    gridCust.gridSpacing.setValueSafely(persoGridGapField.getValue());
    gridCust.magneticCB.setSelected(magneticGridCB.isSelected());
    gridCust.styleList.setSelectedItemSafely(gridStyle.getLabel());
    scaleCust.xRuler.setVisible(displayXScaleCB.isSelected());
    scaleCust.yRuler.setVisible(displayYScaleCB.isSelected());
    scaleCust.xRulerItem.setSelected(displayXScaleCB.isSelected());
    scaleCust.yRulerItem.setSelected(displayYScaleCB.isSelected());
    scaleCust.unitCmItem.setSelected(unitChoice.getSelectedItem().toString().equals(Unit.CM.getLabel()));
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

     * @param showLabels is true, the bottom and right edges of the map are covered with
     * white strips, and labels for the grid lines are placed in the white strips.
     */
  private void drawGrid( MapGraphicContext context, boolean showLabels ) {
       
        GridStyle style = getStyle(context.getLayer());
        double[] gridSize=style.getGridSize();
    

        try{
            MathTransform mt = CRS.findMathTransform(DefaultGeographicCRS.WGS84, context.getCRS(), true);
       
            if( !mt.isIdentity() ){
                double x=gridSize[0]/2.0;
                double y=gridSize[1]/2.0;
                double[] toTransform=new double[]{-x,-y,x,y};
                double[] dest=new double[4];
                mt.transform(toTransform,0,dest,0,2);
                gridSize=new double[]{Math.abs(dest[2]-dest[0]), Math.abs(dest[3]-dest[1])};
            }
        }catch (Exception e) {
            MapGraphicPlugin.log("",e); //$NON-NLS-1$
        }

        Envelope bounds = context.getViewportModel().getBounds();
       
        Coordinate centerCoord = bounds.centre();
        gridSize = style.getGridSize();
        Coordinate topLeftCenterCoord = new Coordinate(centerCoord.x - gridSize[0]/2,
                                                       centerCoord.y + gridSize[1]/2);
        Coordinate topLeftMostCoord = new Coordinate(topLeftCenterCoord);
        while (topLeftMostCoord.x - gridSize[0] > bounds.getMinX()) {
            topLeftMostCoord.x -= gridSize[0];
        }
        while (topLeftMostCoord.y + gridSize[1] < bounds.getMaxY()) {
            topLeftMostCoord.y += gridSize[1];
        }
        Coordinate coord = topLeftMostCoord;

        ViewportGraphics graphics = context.getGraphics();
        int mapPixelWidth = context.getMapDisplay().getWidth();
        int mapPixelHeight = context.getMapDisplay().getHeight();
       
        //cover the right side and bottom of map with thin strips
        final int RIGHT_STRIP_WIDTH = (int)(mapPixelWidth * 0.05);
        final int BOTTOM_STRIP_HEIGHT = (int)(mapPixelHeight * 0.03);
        final int GRID_LINE_EXTENSION = (int)(RIGHT_STRIP_WIDTH * 0.1);
        graphics.setColor(Color.white);
        graphics.fillRect(mapPixelWidth - RIGHT_STRIP_WIDTH,
                          0,
                          RIGHT_STRIP_WIDTH,
                          mapPixelHeight);
        graphics.fillRect(0,
                          mapPixelHeight - BOTTOM_STRIP_HEIGHT,
                          mapPixelWidth,
                          BOTTOM_STRIP_HEIGHT);  
       
        //draw grid lines
        graphics.setColor(style.getColor());
        Point pixel = null;
        while(true){
            pixel = context.worldToPixel(coord);           
            coord.x+=gridSize[0];
            coord.y-=gridSize[1];
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

                          mapPixelHeight - BOTTOM_STRIP_HEIGHT);
     
    }       
   
    private GridStyle getStyle( ILayer layer ) {
        GridStyle gridStyle = (GridStyle) layer.getStyleBlackboard().get(GridStyle.ID);
        if( gridStyle==null ){
            return GridStyle.DEFAULT_STYLE;
        }
        return gridStyle;
    }
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

     * @param showLabels is true, the bottom and right edges of the map are covered with
     * white strips, and labels for the grid lines are placed in the white strips.
     */
    private void drawGrid( MapGraphicContext context, boolean showLabels ) {
       
        GridStyle style = getStyle(context.getLayer());
        double[] gridSize=style.getGridSize();
    

        try{
            MathTransform mt = CRS.findMathTransform(DefaultGeographicCRS.WGS84, context.getCRS(), true);
       
            if( !mt.isIdentity() ){
                double x=gridSize[0]/2.0;
                double y=gridSize[1]/2.0;
                double[] toTransform=new double[]{-x,-y,x,y};
                double[] dest=new double[4];
                mt.transform(toTransform,0,dest,0,2);
                gridSize=new double[]{Math.abs(dest[2]-dest[0]), Math.abs(dest[3]-dest[1])};
            }
        }catch (Exception e) {
            MapGraphicPlugin.log("",e); //$NON-NLS-1$
        }

        Envelope bounds = context.getViewportModel().getBounds();
       
        Coordinate centerCoord = bounds.centre();
        gridSize = style.getGridSize();
        Coordinate topLeftCenterCoord = new Coordinate(centerCoord.x - gridSize[0]/2,
                                                       centerCoord.y + gridSize[1]/2);
        Coordinate topLeftMostCoord = new Coordinate(topLeftCenterCoord);
        while (topLeftMostCoord.x - gridSize[0] > bounds.getMinX()) {
            topLeftMostCoord.x -= gridSize[0];
        }
        while (topLeftMostCoord.y + gridSize[1] < bounds.getMaxY()) {
            topLeftMostCoord.y += gridSize[1];
        }
        Coordinate coord = topLeftMostCoord;

        ViewportGraphics graphics = context.getGraphics();
        int mapPixelWidth = context.getMapDisplay().getWidth();
        int mapPixelHeight = context.getMapDisplay().getHeight();
       
        //cover the right side and bottom of map with thin strips
        final int RIGHT_STRIP_WIDTH = (int)(mapPixelWidth * 0.05);
        final int BOTTOM_STRIP_HEIGHT = (int)(mapPixelHeight * 0.03);
        final int GRID_LINE_EXTENSION = (int)(RIGHT_STRIP_WIDTH * 0.1);
        graphics.setColor(Color.white);
        graphics.fillRect(mapPixelWidth - RIGHT_STRIP_WIDTH,
                          0,
                          RIGHT_STRIP_WIDTH,
                          mapPixelHeight);
        graphics.fillRect(0,
                          mapPixelHeight - BOTTOM_STRIP_HEIGHT,
                          mapPixelWidth,
                          BOTTOM_STRIP_HEIGHT);  
       
        //draw grid lines
        graphics.setColor(style.getColor());
        Point pixel = null;
        while(true){
            pixel = context.worldToPixel(coord);           
            coord.x+=gridSize[0];
            coord.y-=gridSize[1];
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

                          mapPixelHeight - BOTTOM_STRIP_HEIGHT);
     
    }       
   
    private GridStyle getStyle( ILayer layer ) {
        GridStyle gridStyle = (GridStyle) layer.getStyleBlackboard().get(GridStyle.ID);
        if( gridStyle==null ){
            return GridStyle.DEFAULT_STYLE;
        }
        return gridStyle;
    }
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

     * @param showLabels is true, the bottom and right edges of the map are covered with
     * white strips, and labels for the grid lines are placed in the white strips.
     */
    private void drawGrid( MapGraphicContext context, boolean showLabels ) {
       
        GridStyle style = getStyle(context.getLayer());
        double[] gridSize=style.getGridSize();
    

        try{
            MathTransform mt = CRS.findMathTransform(DefaultGeographicCRS.WGS84, context.getCRS(), true);
       
            if( !mt.isIdentity() ){
                double x=gridSize[0]/2.0;
                double y=gridSize[1]/2.0;
                double[] toTransform=new double[]{-x,-y,x,y};
                double[] dest=new double[4];
                mt.transform(toTransform,0,dest,0,2);
                gridSize=new double[]{Math.abs(dest[2]-dest[0]), Math.abs(dest[3]-dest[1])};
            }
        }catch (Exception e) {
            MapGraphicPlugin.log("",e); //$NON-NLS-1$
        }

        Envelope bounds = context.getViewportModel().getBounds();
       
        Coordinate centerCoord = bounds.centre();
        gridSize = style.getGridSize();
        Coordinate topLeftCenterCoord = new Coordinate(centerCoord.x - gridSize[0]/2,
                                                       centerCoord.y + gridSize[1]/2);
        Coordinate topLeftMostCoord = new Coordinate(topLeftCenterCoord);
        while (topLeftMostCoord.x - gridSize[0] > bounds.getMinX()) {
            topLeftMostCoord.x -= gridSize[0];
        }
        while (topLeftMostCoord.y + gridSize[1] < bounds.getMaxY()) {
            topLeftMostCoord.y += gridSize[1];
        }
        Coordinate coord = topLeftMostCoord;

        ViewportGraphics graphics = context.getGraphics();
        int mapPixelWidth = context.getMapDisplay().getWidth();
        int mapPixelHeight = context.getMapDisplay().getHeight();
       
        //cover the right side and bottom of map with thin strips
        final int RIGHT_STRIP_WIDTH = (int)(mapPixelWidth * 0.05);
        final int BOTTOM_STRIP_HEIGHT = (int)(mapPixelHeight * 0.03);
        final int GRID_LINE_EXTENSION = (int)(RIGHT_STRIP_WIDTH * 0.1);
        graphics.setColor(Color.white);
        graphics.fillRect(mapPixelWidth - RIGHT_STRIP_WIDTH,
                          0,
                          RIGHT_STRIP_WIDTH,
                          mapPixelHeight);
        graphics.fillRect(0,
                          mapPixelHeight - BOTTOM_STRIP_HEIGHT,
                          mapPixelWidth,
                          BOTTOM_STRIP_HEIGHT);  
       
        //draw grid lines
        graphics.setColor(style.getColor());
        Point pixel = null;
        while(true){
            pixel = context.worldToPixel(coord);           
            coord.x+=gridSize[0];
            coord.y-=gridSize[1];
View Full Code Here

Examples of org.locationtech.udig.mapgraphic.grid.GridStyle

                          mapPixelHeight - BOTTOM_STRIP_HEIGHT);
     
    }       
   
    private GridStyle getStyle( ILayer layer ) {
        GridStyle gridStyle = (GridStyle) layer.getStyleBlackboard().get(GridStyle.ID);
        if( gridStyle==null ){
            return GridStyle.DEFAULT_STYLE;
        }
        return gridStyle;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.