]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.trend / src / org / simantics / trend / impl / JarisPaints.java
diff --git a/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java b/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java
new file mode 100644 (file)
index 0000000..06e6353
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.trend.impl;\r
+\r
+import java.awt.Color;\r
+\r
+public class JarisPaints {\r
+       \r
+       public static final Color[] JarisPaintSequence;\r
+       public static final String[] JarisPaintName;\r
+\r
+       /**\r
+        * Get color. First color ( blue ) is 1.\r
+        * @param paintIndex\r
+        * @return\r
+        */\r
+       public static Color getColor( int paintIndex )\r
+       {\r
+               return JarisPaintSequence[ modulus(paintIndex-1, JarisPaintSequence.length) ];\r
+       }\r
+       \r
+       public static int modulus( int a, int b )\r
+       {\r
+               return a>=0? a%b : (((a%b)+b)%b);\r
+       }\r
+\r
+       static {\r
+           JarisPaintSequence = new Color[] {\r
+                   new Color(0.00f, 0.00f, 1.00f),\r
+                   new Color(0.00f, 0.50f, 0.00f),\r
+                   new Color(1.00f, 0.00f, 0.00f),\r
+                   new Color(0.00f, 0.75f, 0.75f),\r
+                   new Color(0.75f, 0.00f, 0.75f),\r
+                   new Color(0.40f, 0.40f, 0.00f), // Keltainen\r
+                   new Color(0.25f, 0.25f, 0.25f),\r
+                   new Color(0.75f, 0.25f, 0.25f),\r
+                   new Color(0.75f, 0.75f, 0.00f), // Kirkkaampi keltainen\r
+                   new Color(0.25f, 0.25f, 0.75f),\r
+                   new Color(0.58f, 0.58f, 0.58f),\r
+                   new Color(0.00f, 1.00f, 0.00f),\r
+                   new Color(0.76f, 0.57f, 0.17f),\r
+                   new Color(0.54f, 0.63f, 0.22f),\r
+                   new Color(0.80f, 0.52f, 0.85f),\r
+                   new Color(0.10f, 0.49f, 0.47f),\r
+                   new Color(0.66f, 0.34f, 0.65f),\r
+                   new Color(0.99f, 0.41f, 0.23f)\r
+           };\r
+           JarisPaintName = new String[] {\r
+                   Messages.JarisPaints_0,\r
+                   Messages.JarisPaints_1,\r
+                   Messages.JarisPaints_2,\r
+                   Messages.JarisPaints_3,\r
+                   Messages.JarisPaints_4,\r
+                   Messages.JarisPaints_5,\r
+                   Messages.JarisPaints_6,\r
+                   Messages.JarisPaints_7,\r
+                   Messages.JarisPaints_8,\r
+                   Messages.JarisPaints_9,\r
+                   Messages.JarisPaints_10,\r
+                   Messages.JarisPaints_11,\r
+                   Messages.JarisPaints_12,\r
+                   Messages.JarisPaints_13,\r
+                   Messages.JarisPaints_14,\r
+                   Messages.JarisPaints_15,\r
+                   Messages.JarisPaints_16,\r
+                   Messages.JarisPaints_17\r
+           };  \r
+           \r
+       }\r
+\r
+}\r