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.g2d.svg;
14 import java.util.HashSet;
18 * @author Tuukka Lehtonen
20 public final class SVGUnits {
23 * inches, 1in = 2.54cm
25 public static final String UNIT_IN = "in";
28 * centimeters, 1cm = 10mm
30 public static final String UNIT_CM = "cm";
35 public static final String UNIT_MM = "mm";
38 * points, 1pt = 1/72in
40 public static final String UNIT_PT = "pt";
45 public static final String UNIT_PC = "pc";
48 * px (pixels, relative to the canvas resolution)
50 public static final String UNIT_PX = "px";
53 * User units, equal to px, i.e. pixel units.
55 public static final String UNIT_USER = UNIT_PX;
58 private static final Set<String> validUnitSet;
60 private static final String[] validUnits = {
70 validUnitSet = new HashSet<String>();
71 for (String unit : validUnits) {
72 validUnitSet.add(unit);
77 public static final boolean isValidUnit(String unit) {
78 return validUnitSet.contains(unit);