src/jtwod/engine/metrics/VectorGrid.java
private void initializeGridLines()
    {
        // Get the line counts
        int horizontalLines = this.gridDimensions.getWidth() / this.cellDimensions.getWidth();
        int verticalLines = this.gridDimensions.getHeight() / this.cellDimensions.getHeight();

        // Initialize the textures
        TextureGroup lineTextures = new TextureGroup();
        lineTextures.addTexture(
            "VerticalLine",
            Texture.dashedTexture(
                new Dimensions(
                    1,
                    this.gridDimensions.getHeight() + this.cellDimensions.getHeight()
                ),
                false,
                Color.white,
                Color.black
            )
        );

        lineTextures.addTexture(
            "HorizontalLine",
            Texture.dashedTexture(
                new Dimensions(
                    this.gridDimensions.getWidth() + this.cellDimensions.getWidth(),
                    1
                ),
                true,
                Color.white,
                Color.black
            )
        );

        // Create Vertical lines
        for (int i = 0;i<=verticalLines+1; i++) {
            this.getSubDrawableGroup().addDrawable(
                new Image<>(
                    Integer.MAX_VALUE,
                    lineTextures.getTexture(
                        "VerticalLine"
                    ),
                    this.getUnconstrainedVectorAtGridPoint(
                        i+1,
                        1
                    ),
                    this.getParentEngine(),
                    this.getParentScene()
                )
            );
        }

        for (int i = 0;i<=horizontalLines+1; i++) {
            this.getSubDrawableGroup().addDrawable(
                new Image<>(
                    Integer.MAX_VALUE,
                    lineTextures.getTexture(
                        "HorizontalLine"
                    ),
                    this.getUnconstrainedVectorAtGridPoint(
                        1,
                        i+1
                    ),
                    this.getParentEngine(),
                    this.getParentScene()
                )
            );
        }

        int cellCountX = this.gridDimensions.getWidth() / this.cellDimensions.getWidth();
        int cellCountY = this.gridDimensions.getHeight() / this.cellDimensions.getHeight();

        for (int row = 1; row<=cellCountY+1; row++) {
            for (int column = 1; column<=cellCountX+1; column++) {
                Vector start = this.getUnconstrainedVectorAtGridPoint(column, row);
                this.getSubDrawableGroup().addDrawable(
                    new Text<>(
                        Integer.MAX_VALUE,
                        "x: " + column + ", y: " + row,
                        new Font(
                            "System",
                            Font.PLAIN,
                            10
                        ),
                        Color.yellow,
                        start.plusY(10).plusX(3),
                        this.getParentEngine(),
                        this.getParentScene()
                    )
                );
                this.getSubDrawableGroup().addDrawable(
                    new Image<>(
                        Integer.MAX_VALUE,
                        Texture.colorTexture(
                            Color.RED,
                            Dimensions.Square(3)
                        ),
                        start.plusY(-1).plusX(-1),
                        this.getParentEngine(),
                        this.getParentScene()
                    )
                );
            }
        }
    }
/**
     * Initialize the drawables for this VectorGrids Grid Lines.
     */
Initialize the drawables for this VectorGrids Grid Lines.
Initialize the drawables for this VectorGrids Grid Lines .
private void initializeGridLines()
    {
        int horizontalLines = this.gridDimensions.getWidth() / this.cellDimensions.getWidth();
        int verticalLines = this.gridDimensions.getHeight() / this.cellDimensions.getHeight();
        TextureGroup lineTextures = new TextureGroup();
        lineTextures.addTexture(
            "VerticalLine",
            Texture.dashedTexture(
                new Dimensions(
                    1,
                    this.gridDimensions.getHeight() + this.cellDimensions.getHeight()
                ),
                false,
                Color.white,
                Color.black
            )
        );
        lineTextures.addTexture(
            "HorizontalLine",
            Texture.dashedTexture(
                new Dimensions(
                    this.gridDimensions.getWidth() + this.cellDimensions.getWidth(),
                    1
                ),
                true,
                Color.white,
                Color.black
            )
        );
        for (int i = 0;i<=verticalLines+1; i++) {
            this.getSubDrawableGroup().addDrawable(
                new Image<>(
                    Integer.MAX_VALUE,
                    lineTextures.getTexture(
                        "VerticalLine"
                    ),
                    this.getUnconstrainedVectorAtGridPoint(
                        i+1,
                        1
                    ),
                    this.getParentEngine(),
                    this.getParentScene()
                )
            );
        }
        for (int i = 0;i<=horizontalLines+1; i++) {
            this.getSubDrawableGroup().addDrawable(
                new Image<>(
                    Integer.MAX_VALUE,
                    lineTextures.getTexture(
                        "HorizontalLine"
                    ),
                    this.getUnconstrainedVectorAtGridPoint(
                        1,
                        i+1
                    ),
                    this.getParentEngine(),
                    this.getParentScene()
                )
            );
        }
        int cellCountX = this.gridDimensions.getWidth() / this.cellDimensions.getWidth();
        int cellCountY = this.gridDimensions.getHeight() / this.cellDimensions.getHeight();
        for (int row = 1; row<=cellCountY+1; row++) {
            for (int column = 1; column<=cellCountX+1; column++) {
                Vector start = this.getUnconstrainedVectorAtGridPoint(column, row);
                this.getSubDrawableGroup().addDrawable(
                    new Text<>(
                        Integer.MAX_VALUE,
                        "x: " + column + ", y: " + row,
                        new Font(
                            "System",
                            Font.PLAIN,
                            10
                        ),
                        Color.yellow,
                        start.plusY(10).plusX(3),
                        this.getParentEngine(),
                        this.getParentScene()
                    )
                );
                this.getSubDrawableGroup().addDrawable(
                    new Image<>(
                        Integer.MAX_VALUE,
                        Texture.colorTexture(
                            Color.RED,
                            Dimensions.Square(3)
                        ),
                        start.plusY(-1).plusX(-1),
                        this.getParentEngine(),
                        this.getParentScene()
                    )
                );
            }
        }
    }
private void initializeGridLines ( ) { int horizontalLines = this . gridDimensions . getWidth ( ) / this . cellDimensions . getWidth ( ) ; int verticalLines = this . gridDimensions . getHeight ( ) / this . cellDimensions . getHeight ( ) ; TextureGroup lineTextures = new TextureGroup ( ) ; lineTextures . addTexture ( "VerticalLine" , Texture . dashedTexture ( new Dimensions ( 1 , this . gridDimensions . getHeight ( ) + this . cellDimensions . getHeight ( ) ) , false , Color . white , Color . black ) ) ; lineTextures . addTexture ( "HorizontalLine" , Texture . dashedTexture ( new Dimensions ( this . gridDimensions . getWidth ( ) + this . cellDimensions . getWidth ( ) , 1 ) , true , Color . white , Color . black ) ) ; for ( int i = 0 ; i <= verticalLines + 1 ; i ++ ) { this . getSubDrawableGroup ( ) . addDrawable ( new Image < > ( Integer . MAX_VALUE , lineTextures . getTexture ( "VerticalLine" ) , this . getUnconstrainedVectorAtGridPoint ( i + 1 , 1 ) , this . getParentEngine ( ) , this . getParentScene ( ) ) ) ; } for ( int i = 0 ; i <= horizontalLines + 1 ; i ++ ) { this . getSubDrawableGroup ( ) . addDrawable ( new Image < > ( Integer . MAX_VALUE , lineTextures . getTexture ( "HorizontalLine" ) , this . getUnconstrainedVectorAtGridPoint ( 1 , i + 1 ) , this . getParentEngine ( ) , this . getParentScene ( ) ) ) ; } int cellCountX = this . gridDimensions . getWidth ( ) / this . cellDimensions . getWidth ( ) ; int cellCountY = this . gridDimensions . getHeight ( ) / this . cellDimensions . getHeight ( ) ; for ( int row = 1 ; row <= cellCountY + 1 ; row ++ ) { for ( int column = 1 ; column <= cellCountX + 1 ; column ++ ) { Vector start = this . getUnconstrainedVectorAtGridPoint ( column , row ) ; this . getSubDrawableGroup ( ) . addDrawable ( new Text < > ( Integer . MAX_VALUE , "x: " + column + ", y: " + row , new Font ( "System" , Font . PLAIN , 10 ) , Color . yellow , start . plusY ( 10 ) . plusX ( 3 ) , this . getParentEngine ( ) , this . getParentScene ( ) ) ) ; this . getSubDrawableGroup ( ) . addDrawable ( new Image < > ( Integer . MAX_VALUE , Texture . colorTexture ( Color . RED , Dimensions . Square ( 3 ) ) , start . plusY ( - 1 ) . plusX ( - 1 ) , this . getParentEngine ( ) , this . getParentScene ( ) ) ) ; } } }
Initialize the drawables for this VectorGrids Grid Lines.
Initialize the drawables for this VectorGrids Grid Lines .
// Get the line counts // Initialize the textures // Create Vertical lines