Debian Codegraph @

freehep-graphicsio-cgm/src/main/java/org/freehep/graphicsio/cgm/ScalingMode.java

raw symbols SCIP
1 // Copyright 2001, FreeHEP.
2 package org.freehep.graphicsio.cgm;
3
4 import java.io.IOException;
5
6 /**
7 * ScalingMode TAG.
8 *
9 * @author Mark Donszelmann
10 * @author Charles Loomis
11 * @version $Id: freehep-graphicsio-cgm/src/main/java/org/freehep/graphicsio/cgm/ScalingMode.java 278fac7cefaa 2005/12/05 04:00:43 duns $
12 */
13 public class ScalingMode extends CGMTag {
14
15 public static final int ABSTRACT = 0;
16
17 public static final int METRIC = 1;
18
19 private int type;
20
21 private double factor;
22
23 public ScalingMode() {
24 super(2, 1, 1);
25 }
26
27 public ScalingMode(int type) {
28 this(ABSTRACT, 0.0);
29 }
30
31 public ScalingMode(int type, double factor) {
32 this();
33 this.type = type;
34 this.factor = factor;
35 }
36
37 public void write(int tagID, CGMOutputStream cgm) throws IOException {
38 cgm.writeEnumerate(type);
39 if (type == METRIC) {
40 cgm.writeFloatingPoint(factor);
41 }
42 }
43
44 public void write(int tagID, CGMWriter cgm) throws IOException {
45 cgm.print("SCALEMODE ");
46 cgm.print((type == ABSTRACT) ? "ABSTRACT " : "METRIC ");
47 if (type == METRIC) {
48 cgm.writeFloatingPoint(factor);
49 }
50 }
51 }