]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/svg/FillDesc.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / svg / FillDesc.java
index 27ffb1aea8a6154f89fd2636254e3549caa5ca06..9c0b516bc6f40eb8fb05f64d4c6bddb1be722513 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in 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.g2d.svg;\r
-\r
-//import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;\r
-//\r
-//import org.apache.batik.util.CSSConstants;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class FillDesc {\r
-\r
-//    public static final FillDesc NO_FILL = new FillDesc(SVG_NONE_VALUE) {\r
-//        @Override\r
-//        public String toStyleString() {\r
-//            return "fill:none;";\r
-//        }\r
-//        @Override\r
-//        public void setFillRule(FillRule rule) {\r
-//            throw new UnsupportedOperationException("immutable object");\r
-//        }\r
-//        @Override\r
-//        public void setOpacity(double opacity) {\r
-//            throw new UnsupportedOperationException("immutable object");\r
-//        }\r
-//        @Override\r
-//        public void setPaint(String paint) {\r
-//            throw new UnsupportedOperationException("immutable object");\r
-//        }\r
-//    };\r
-\r
-\r
-    //private static final String[] ruleConv      = { "nonzero", "evenodd" };\r
-\r
-    /**\r
-     * paint | inherit\r
-     */\r
-    private String paint;\r
-\r
-    /**\r
-     * [0,1] | "inherit"\r
-     */\r
-    private double opacity;\r
-\r
-    /**\r
-     * nonzero | evenodd | inherit\r
-     */\r
-    private FillRule fillRule;\r
-\r
-    \r
-    public FillDesc() {\r
-        this(StyleConstants.INHERIT, 1, FillRule.nonzero);\r
-    }\r
-    \r
-    public FillDesc(String paint) {\r
-        this(paint, 1, FillRule.nonzero);\r
-    }\r
-    \r
-    public FillDesc(String paint, double opacity) {\r
-        this(paint, opacity, FillRule.nonzero);\r
-    }\r
-    \r
-    public FillDesc(String paint, double opacity, FillRule fillRule) {\r
-        this.paint = paint;\r
-        this.opacity = opacity;\r
-        this.fillRule = fillRule != null ? fillRule : FillRule.nonzero;\r
-    }\r
-\r
-    public String getPaint() {\r
-        return paint;\r
-    }\r
-    \r
-    public void setPaint(String paint) {\r
-        this.paint = paint;\r
-    }\r
-    \r
-    public double getOpacity() {\r
-        return opacity;\r
-    }\r
-    \r
-    public void setOpacity(double opacity) {\r
-        this.opacity = opacity;\r
-    }\r
-    \r
-    public FillRule getFillRule() {\r
-        return fillRule;\r
-    }\r
-    \r
-    public void setFillRule(FillRule rule) {\r
-        this.fillRule = rule;\r
-    }\r
-    \r
-    /**\r
-     * Returns the hashcode for this stroke.\r
-     * \r
-     * @return a hash code for this stroke.\r
-     */\r
-    public int hashCode() {\r
-        int hash = paint.hashCode();\r
-        hash = hash * 31 + (int) Double.doubleToLongBits(opacity);\r
-        hash = hash * 31 + fillRule.hashCode();\r
-        return hash;\r
-    }\r
-\r
-    /**\r
-     * Returns true if this BasicStroke represents the same stroking operation\r
-     * as the given argument.\r
-     * \r
-     * <p>\r
-     * Tests if a specified object is equal to this <code>Stroke</code> by\r
-     * first testing if it is a <code>BasicStroke</code> and then comparing\r
-     * its width, join, cap, miter limit, dash, and dash phase attributes with\r
-     * those of this <code>Stroke</code>.\r
-     * \r
-     * @param obj the specified object to compare to this <code>Stroke</code>\r
-     * @return <code>true</code> if the width, join, cap, miter limit, dash,\r
-     *         and dash phase are the same for both objects; <code>false</code>\r
-     *         otherwise.\r
-     */\r
-    public boolean equals(Object obj) {\r
-        if (!(obj instanceof FillDesc)) {\r
-            return false;\r
-        }\r
-\r
-        FillDesc fd = (FillDesc) obj;\r
-        if (opacity != fd.opacity) {\r
-            return false;\r
-        }\r
-        if (!fillRule.equals(fd.fillRule)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-    \r
-//    public String toStyleString() {\r
-//        StringBuilder s = new StringBuilder(64);\r
-//        \r
-//        s.append(CSSConstants.CSS_FILL_PROPERTY);\r
-//        s.append(':');\r
-//        s.append(paint);\r
-//        s.append(';');\r
-//        if (!paint.equals(CSSConstants.CSS_NONE_VALUE)) {\r
-//            s.append(CSSConstants.CSS_FILL_OPACITY_PROPERTY);\r
-//            s.append(':');\r
-//            s.append(opacity);\r
-//            s.append(';');\r
-//            s.append(CSSConstants.CSS_FILL_RULE_PROPERTY);\r
-//            s.append(':');\r
-//            s.append(fillRule);\r
-//            s.append(';');\r
-//        }\r
-//        \r
-//        return s.toString();\r
-//    }\r
-    \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.svg;
+
+//import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
+//
+//import org.apache.batik.util.CSSConstants;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class FillDesc {
+
+//    public static final FillDesc NO_FILL = new FillDesc(SVG_NONE_VALUE) {
+//        @Override
+//        public String toStyleString() {
+//            return "fill:none;";
+//        }
+//        @Override
+//        public void setFillRule(FillRule rule) {
+//            throw new UnsupportedOperationException("immutable object");
+//        }
+//        @Override
+//        public void setOpacity(double opacity) {
+//            throw new UnsupportedOperationException("immutable object");
+//        }
+//        @Override
+//        public void setPaint(String paint) {
+//            throw new UnsupportedOperationException("immutable object");
+//        }
+//    };
+
+
+    //private static final String[] ruleConv      = { "nonzero", "evenodd" };
+
+    /**
+     * paint | inherit
+     */
+    private String paint;
+
+    /**
+     * [0,1] | "inherit"
+     */
+    private double opacity;
+
+    /**
+     * nonzero | evenodd | inherit
+     */
+    private FillRule fillRule;
+
+    
+    public FillDesc() {
+        this(StyleConstants.INHERIT, 1, FillRule.nonzero);
+    }
+    
+    public FillDesc(String paint) {
+        this(paint, 1, FillRule.nonzero);
+    }
+    
+    public FillDesc(String paint, double opacity) {
+        this(paint, opacity, FillRule.nonzero);
+    }
+    
+    public FillDesc(String paint, double opacity, FillRule fillRule) {
+        this.paint = paint;
+        this.opacity = opacity;
+        this.fillRule = fillRule != null ? fillRule : FillRule.nonzero;
+    }
+
+    public String getPaint() {
+        return paint;
+    }
+    
+    public void setPaint(String paint) {
+        this.paint = paint;
+    }
+    
+    public double getOpacity() {
+        return opacity;
+    }
+    
+    public void setOpacity(double opacity) {
+        this.opacity = opacity;
+    }
+    
+    public FillRule getFillRule() {
+        return fillRule;
+    }
+    
+    public void setFillRule(FillRule rule) {
+        this.fillRule = rule;
+    }
+    
+    /**
+     * Returns the hashcode for this stroke.
+     * 
+     * @return a hash code for this stroke.
+     */
+    public int hashCode() {
+        int hash = paint.hashCode();
+        hash = hash * 31 + (int) Double.doubleToLongBits(opacity);
+        hash = hash * 31 + fillRule.hashCode();
+        return hash;
+    }
+
+    /**
+     * Returns true if this BasicStroke represents the same stroking operation
+     * as the given argument.
+     * 
+     * <p>
+     * Tests if a specified object is equal to this <code>Stroke</code> by
+     * first testing if it is a <code>BasicStroke</code> and then comparing
+     * its width, join, cap, miter limit, dash, and dash phase attributes with
+     * those of this <code>Stroke</code>.
+     * 
+     * @param obj the specified object to compare to this <code>Stroke</code>
+     * @return <code>true</code> if the width, join, cap, miter limit, dash,
+     *         and dash phase are the same for both objects; <code>false</code>
+     *         otherwise.
+     */
+    public boolean equals(Object obj) {
+        if (!(obj instanceof FillDesc)) {
+            return false;
+        }
+
+        FillDesc fd = (FillDesc) obj;
+        if (opacity != fd.opacity) {
+            return false;
+        }
+        if (!fillRule.equals(fd.fillRule)) {
+            return false;
+        }
+        return true;
+    }
+    
+//    public String toStyleString() {
+//        StringBuilder s = new StringBuilder(64);
+//        
+//        s.append(CSSConstants.CSS_FILL_PROPERTY);
+//        s.append(':');
+//        s.append(paint);
+//        s.append(';');
+//        if (!paint.equals(CSSConstants.CSS_NONE_VALUE)) {
+//            s.append(CSSConstants.CSS_FILL_OPACITY_PROPERTY);
+//            s.append(':');
+//            s.append(opacity);
+//            s.append(';');
+//            s.append(CSSConstants.CSS_FILL_RULE_PROPERTY);
+//            s.append(':');
+//            s.append(fillRule);
+//            s.append(';');
+//        }
+//        
+//        return s.toString();
+//    }
+    
+}