/
IGraphics.java
148 lines (100 loc) · 3.46 KB
/
IGraphics.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*******************************************************************************************************
*
* msi.gama.common.interfaces.IGraphics.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling
* and simulation platform (v. 1.8.1)
*
* (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.common.interfaces;
import java.awt.Color;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.outputs.layers.OverlayLayer;
import msi.gama.outputs.layers.charts.ChartOutput;
import msi.gama.util.file.GamaFile;
import msi.gama.util.matrix.IField;
import msi.gaml.statements.draw.DrawingAttributes;
import msi.gaml.statements.draw.MeshDrawingAttributes;
import msi.gaml.statements.draw.TextDrawingAttributes;
/**
* Written by drogoul Modified on 22 janv. 2011
*
* @todo Description
*
*/
public interface IGraphics {
public interface ThreeD extends IGraphics {
@Override
default boolean is2D() {
return false;
}
ILocation getCameraPos();
ILocation getCameraTarget();
ILocation getCameraOrientation();
}
RenderingHints QUALITY_RENDERING = new RenderingHints(null);
RenderingHints SPEED_RENDERING = new RenderingHints(null);
RenderingHints MEDIUM_RENDERING = new RenderingHints(null);
void setDisplaySurface(final IDisplaySurface surface);
int getDisplayWidth();
int getDisplayHeight();
Rectangle2D drawFile(GamaFile<?, ?> file, DrawingAttributes attributes);
Rectangle2D drawField(final IField values, final MeshDrawingAttributes attributes);
Rectangle2D drawImage(final BufferedImage img, final DrawingAttributes attributes);
Rectangle2D drawChart(ChartOutput chart);
Rectangle2D drawString(final String string, final TextDrawingAttributes attributes);
Rectangle2D drawShape(final Geometry shape, final DrawingAttributes attributes);
void setOpacity(double i);
void fillBackground(Color bgColor, double opacity);
boolean beginDrawingLayers();
void beginDrawingLayer(ILayer layer);
void beginOverlay(OverlayLayer layer);
void endOverlay();
double getyRatioBetweenPixelsAndModelUnits();
double getxRatioBetweenPixelsAndModelUnits();
/*
* Returns the region of the current layer (in model units) that is visible on screen
*/
Envelope getVisibleRegion();
void endDrawingLayer(ILayer layer);
void endDrawingLayers();
void beginHighlight();
void endHighlight();
double getXOffsetInPixels();
double getYOffsetInPixels();
Double getZoomLevel();
default boolean is2D() {
return true;
}
int getViewWidth();
int getViewHeight();
IDisplaySurface getSurface();
default double getMaxEnvDim() {
return getSurface().getData().getMaxEnvDim();
}
default double getEnvWidth() {
return getSurface().getData().getEnvWidth();
}
default double getEnvHeight() {
return getSurface().getData().getEnvHeight();
}
void dispose();
boolean cannotDraw();
boolean isNotReadyToUpdate();
/**
* Ask the IGraphics instance to accumulate temporary envelopes
*
* @param env
*/
default void accumulateTemporaryEnvelope(final Rectangle2D env) {}
default Rectangle2D getAndWipeTemporaryEnvelope() {
return null;
}
}