1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.flag;
14 import java.awt.Shape;
15 import java.awt.geom.Rectangle2D;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.g2d.canvas.ICanvasContext;
20 import org.simantics.g2d.elementclass.FlagClass;
21 import org.simantics.g2d.utils.Alignment;
24 * @author Tuukka Lehtonen
26 public interface IFlagType {
29 * @author Tuukka Lehtonen
32 public interface FlagInfo {
35 Rectangle2D getTextArea();
36 FlagClass.Type getType();
37 Alignment getHorizontalAlignment();
38 Alignment getVerticalAlignment();
42 * Reads and calculates information about this flags graphical
45 * @param graph database read access
46 * @return all info gathered up about the flag
47 * @throws DatabaseException
48 * @Deprecated implement {@link #getInfo(ReadGraph, ICanvasContext)} instead
50 default FlagInfo getInfo(ReadGraph graph) throws DatabaseException {
51 throw new UnsupportedOperationException();
55 * Reads and calculates information about this flags graphical
58 * @param graph database read access
59 * @param context the canvas context with which the info is loaded
60 * @return all info gathered up about the flag
61 * @throws DatabaseException
63 default FlagInfo getInfo(ReadGraph graph, ICanvasContext context) throws DatabaseException {
64 return getInfo(graph);