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;
15 import java.awt.Shape;
16 import java.awt.geom.Rectangle2D;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.g2d.canvas.ICanvasContext;
21 import org.simantics.g2d.elementclass.FlagClass;
22 import org.simantics.g2d.utils.Alignment;
25 * @author Tuukka Lehtonen
27 public interface IFlagType {
30 * @author Tuukka Lehtonen
33 public interface FlagInfo {
36 Rectangle2D getTextArea();
37 FlagClass.Type getType();
38 Alignment getHorizontalAlignment();
39 Alignment getVerticalAlignment();
44 * Reads and calculates information about this flags graphical
47 * @param graph database read access
48 * @return all info gathered up about the flag
49 * @throws DatabaseException
50 * @Deprecated implement {@link #getInfo(ReadGraph, ICanvasContext)} instead
52 default FlagInfo getInfo(ReadGraph graph) throws DatabaseException {
53 throw new UnsupportedOperationException();
57 * Reads and calculates information about this flags graphical
60 * @param graph database read access
61 * @param context the canvas context with which the info is loaded
62 * @return all info gathered up about the flag
63 * @throws DatabaseException
65 default FlagInfo getInfo(ReadGraph graph, ICanvasContext context) throws DatabaseException {
66 return getInfo(graph);