2 * Sixth - System for data storage, computation, exploration and interaction.
3 * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.sixth.e3d.examples;
12 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
13 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
14 import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
15 import eu.svjatoslav.sixth.e3d.geometry.Transform;
16 import eu.svjatoslav.sixth.e3d.gui.ViewContext;
17 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
18 import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.TextEditComponent;
19 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
20 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
21 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
22 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid2D;
24 public class TextEditorDemo {
26 private static Grid2D createGrid() {
27 final Transform transform = new Transform(new Point3D(0, 100, 0), 0,
30 final Rectangle rectangle = new Rectangle(2000);
31 final LineAppearance appearance = new LineAppearance(10, new Color(
34 return new Grid2D(transform, rectangle, 10, 10, appearance);
37 public static void main(final String[] args) {
39 final ViewFrame viewFrame = new ViewFrame();
40 final ViewContext viewContext = viewFrame.getView().getContext();
42 final ShapeCollection shapeCollection = viewFrame.getView()
43 .getContext().getRootShapeCollection();
45 shapeCollection.addShape(createGrid());
48 for (double z = -500 * m; z <= (500 * m); z += 250 * m)
49 for (double x = -500 * m; x <= (500 * m); x += 250 * m) {
51 final TextEditComponent textEditor = new TextEditComponent(
52 new Transform(new Point3D(x, 0, z)), viewContext,
53 new Point2D(200, 120));
55 shapeCollection.addShape(textEditor);
58 viewContext.getAvatar().setLocation(new Point3D(500, -300, -800));
59 viewContext.getAvatar().setAngleXZ(0.6);
60 viewContext.getAvatar().setAngleYZ(-0.5);