]> _ Git - cubeextranet.git/blob
d9432961f666d8f44a2a1f19592170f72cd1bf01
[cubeextranet.git] /
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package org.apache.pdfbox.pdmodel.interactive.measurement;
18
19 import org.apache.pdfbox.cos.COSBase;
20 import org.apache.pdfbox.cos.COSDictionary;
21 import org.apache.pdfbox.cos.COSName;
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
23
24 /**
25  * This class represents a measure dictionary.
26  * 
27  * @version $Revision: 1.0 $
28  *
29  */
30 public class PDMeasureDictionary implements COSObjectable
31 {
32     /**
33      * The type of the dictionary.
34      */
35     public static final String TYPE = "Measure";
36
37     private COSDictionary measureDictionary;
38
39     /**
40      * Constructor.
41      */
42     protected PDMeasureDictionary()
43     {
44         this.measureDictionary = new COSDictionary();
45         this.getDictionary().setName(COSName.TYPE, TYPE);
46     }
47
48     /**
49      * Constructor.
50      * 
51      * @param dictionary the corresponding dictionary
52      */
53     public PDMeasureDictionary(COSDictionary dictionary)
54     {
55         this.measureDictionary = dictionary;
56     }
57
58     /**
59      * {@inheritDoc}
60      */
61     public COSBase getCOSObject()
62     {
63         return this.measureDictionary;
64     }
65
66     /**
67      * This will return the corresponding dictionary.
68      * 
69      * @return the measure dictionary
70      */
71     public COSDictionary getDictionary()
72     {
73         return this.measureDictionary;
74     }
75
76     /**
77      * This will return the type of the measure dictionary.
78      * It must be "Measure"
79      * 
80      * @return the type
81      */
82     public String getType()
83     {
84         return TYPE;
85     }
86
87     /**
88      * returns the subtype of the measure dictionary.
89      * @return the subtype of the measure data dictionary
90      */
91
92     public String getSubtype()
93     {
94         return this.getDictionary().getNameAsString(COSName.SUBTYPE,
95                 PDRectlinearMeasureDictionary.SUBTYPE);
96     }
97
98     /**
99      * This will set the subtype of the measure dictionary.
100      * @param subtype the subtype of the measure dictionary
101      */
102     protected void setSubtype(String subtype)
103     {
104         this.getDictionary().setName(COSName.SUBTYPE, subtype);
105     }
106
107 }