PageRenderTime 31ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/de/micromata/opengis/kml/v_2_2_0/ViewVolume.java

http://javaapiforkml.googlecode.com/
Java | 546 lines | 240 code | 38 blank | 268 comment | 33 complexity | ae4c5cd5bcaf40001d7ec054151cfbcb MD5 | raw file
Possible License(s): BSD-3-Clause
  1. package de.micromata.opengis.kml.v_2_2_0;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import javax.xml.bind.annotation.XmlAccessType;
  5. import javax.xml.bind.annotation.XmlAccessorType;
  6. import javax.xml.bind.annotation.XmlElement;
  7. import javax.xml.bind.annotation.XmlRootElement;
  8. import javax.xml.bind.annotation.XmlSchemaType;
  9. import javax.xml.bind.annotation.XmlType;
  10. import de.micromata.opengis.kml.v_2_2_0.annotations.Obvious;
  11. /**
  12. * <viewvolume>
  13. * <p>
  14. * Defines how much of the current scene is visible. Specifying the field of view is
  15. * analogous to specifying the lens opening in a physical camera. A small field of
  16. * view, like a telephoto lens, focuses on a small part of the scene. A large field
  17. * of view, like a wide-angle lens, focuses on a large part of the scene.
  18. * </p>
  19. *
  20. *
  21. *
  22. */
  23. @XmlAccessorType(XmlAccessType.FIELD)
  24. @XmlType(name = "ViewVolumeType", propOrder = {
  25. "leftFov",
  26. "rightFov",
  27. "bottomFov",
  28. "topFov",
  29. "near",
  30. "viewVolumeSimpleExtension",
  31. "viewVolumeObjectExtension"
  32. })
  33. @XmlRootElement(name = "ViewVolume", namespace = "http://www.opengis.net/kml/2.2")
  34. public class ViewVolume
  35. extends AbstractObject
  36. implements Cloneable
  37. {
  38. /**
  39. * <leftfov>
  40. * <p>
  41. * Angle, in degrees, between the camera's viewing direction and the left side of the
  42. * view volume.
  43. * </p>
  44. *
  45. *
  46. *
  47. */
  48. @XmlElement(defaultValue = "0.0")
  49. protected double leftFov;
  50. /**
  51. * <rightfov>
  52. * <p>
  53. * Angle, in degrees, between the camera's viewing direction and the right side of
  54. * the view volume.
  55. * </p>
  56. *
  57. *
  58. *
  59. */
  60. @XmlElement(defaultValue = "0.0")
  61. protected double rightFov;
  62. /**
  63. * <bottomfov>
  64. * <p>
  65. * Angle, in degrees, between the camera's viewing direction and the bottom side of
  66. * the view volume.
  67. * </p>
  68. *
  69. *
  70. *
  71. */
  72. @XmlElement(defaultValue = "0.0")
  73. protected double bottomFov;
  74. /**
  75. * <topfov>
  76. * <p>
  77. * Angle, in degrees, between the camera's viewing direction and the top side of the
  78. * view volume.
  79. * </p>
  80. *
  81. *
  82. *
  83. */
  84. @XmlElement(defaultValue = "0.0")
  85. protected double topFov;
  86. /**
  87. * <near>
  88. * <p>
  89. * <leftFov> Angle, in degrees, between the camera's viewing direction and the left
  90. * side of the view volume. <rightFov> Angle, in degrees, between the camera's viewing
  91. * direction and the right side of the view volume. <bottomFov> Angle, in degrees,
  92. * between the camera's viewing direction and the bottom side of the view volume. <topFov>
  93. * Angle, in degrees, between the camera's viewing direction and the top side of the
  94. * view volume. <near> Measurement in meters along the viewing direction from the camera
  95. * viewpoint to the PhotoOverlay shape.
  96. * </p>
  97. * <p>
  98. * Measurement in meters along the viewing direction from the camera viewpoint to the
  99. * PhotoOverlay shape.
  100. * </p>
  101. * <p>
  102. * The field of view for a PhotoOverlay is defined by four planes, each of which is
  103. * specified by an angle relative to the view vector. These four planes define the
  104. * top, bottom, left, and right sides of the field of view, which has the shape of
  105. * a truncated pyramid, as shown here:
  106. * </p>
  107. * <p>
  108. * The following diagrams show the four field-of-view angles within this pyramid:
  109. * </p>
  110. * <p>
  111. * The following diagrams show the four field-of-view angles within this pyramid:
  112. * </p>
  113. *
  114. *
  115. *
  116. */
  117. @XmlElement(defaultValue = "0.0")
  118. protected double near;
  119. @XmlElement(name = "ViewVolumeSimpleExtensionGroup")
  120. @XmlSchemaType(name = "anySimpleType")
  121. protected List<Object> viewVolumeSimpleExtension;
  122. /**
  123. * <Object>
  124. * <p>
  125. * This is an abstract base class and cannot be used directly in a KML file. It provides
  126. * the id attribute, which allows unique identification of a KML element, and the targetId
  127. * attribute, which is used to reference objects that have already been loaded into
  128. * Google Earth. The id attribute must be assigned if the <Update> mechanism is to
  129. * be used.
  130. * </p>
  131. *
  132. * Syntax:
  133. * <pre>&lt;!-- abstract element; do not create --&gt;<strong>
  134. * &lt;!-- <em>Object</em> id="ID" targetId="NCName" --&gt;
  135. * &lt;!-- /<em>Object</em>&gt; --&gt;</strong></pre>
  136. *
  137. *
  138. *
  139. */
  140. @XmlElement(name = "ViewVolumeObjectExtensionGroup")
  141. protected List<AbstractObject> viewVolumeObjectExtension;
  142. public ViewVolume() {
  143. super();
  144. }
  145. /**
  146. * @see leftFov
  147. *
  148. * @return
  149. * possible object is
  150. * {@link Double}
  151. *
  152. */
  153. public double getLeftFov() {
  154. return leftFov;
  155. }
  156. /**
  157. * @see leftFov
  158. *
  159. * @param value
  160. * allowed object is
  161. * {@link Double}
  162. *
  163. */
  164. public void setLeftFov(double value) {
  165. this.leftFov = value;
  166. }
  167. /**
  168. * @see rightFov
  169. *
  170. * @return
  171. * possible object is
  172. * {@link Double}
  173. *
  174. */
  175. public double getRightFov() {
  176. return rightFov;
  177. }
  178. /**
  179. * @see rightFov
  180. *
  181. * @param value
  182. * allowed object is
  183. * {@link Double}
  184. *
  185. */
  186. public void setRightFov(double value) {
  187. this.rightFov = value;
  188. }
  189. /**
  190. * @see bottomFov
  191. *
  192. * @return
  193. * possible object is
  194. * {@link Double}
  195. *
  196. */
  197. public double getBottomFov() {
  198. return bottomFov;
  199. }
  200. /**
  201. * @see bottomFov
  202. *
  203. * @param value
  204. * allowed object is
  205. * {@link Double}
  206. *
  207. */
  208. public void setBottomFov(double value) {
  209. this.bottomFov = value;
  210. }
  211. /**
  212. * @see topFov
  213. *
  214. * @return
  215. * possible object is
  216. * {@link Double}
  217. *
  218. */
  219. public double getTopFov() {
  220. return topFov;
  221. }
  222. /**
  223. * @see topFov
  224. *
  225. * @param value
  226. * allowed object is
  227. * {@link Double}
  228. *
  229. */
  230. public void setTopFov(double value) {
  231. this.topFov = value;
  232. }
  233. /**
  234. * @see near
  235. *
  236. * @return
  237. * possible object is
  238. * {@link Double}
  239. *
  240. */
  241. public double getNear() {
  242. return near;
  243. }
  244. /**
  245. * @see near
  246. *
  247. * @param value
  248. * allowed object is
  249. * {@link Double}
  250. *
  251. */
  252. public void setNear(double value) {
  253. this.near = value;
  254. }
  255. /**
  256. * @see viewVolumeSimpleExtension
  257. *
  258. */
  259. public List<Object> getViewVolumeSimpleExtension() {
  260. if (viewVolumeSimpleExtension == null) {
  261. viewVolumeSimpleExtension = new ArrayList<Object>();
  262. }
  263. return this.viewVolumeSimpleExtension;
  264. }
  265. /**
  266. * @see viewVolumeObjectExtension
  267. *
  268. */
  269. public List<AbstractObject> getViewVolumeObjectExtension() {
  270. if (viewVolumeObjectExtension == null) {
  271. viewVolumeObjectExtension = new ArrayList<AbstractObject>();
  272. }
  273. return this.viewVolumeObjectExtension;
  274. }
  275. @Override
  276. public int hashCode() {
  277. final int prime = 31;
  278. int result = super.hashCode();
  279. long temp;
  280. temp = Double.doubleToLongBits(leftFov);
  281. result = ((prime*result)+((int)(temp^(temp >>>(32)))));
  282. temp = Double.doubleToLongBits(rightFov);
  283. result = ((prime*result)+((int)(temp^(temp >>>(32)))));
  284. temp = Double.doubleToLongBits(bottomFov);
  285. result = ((prime*result)+((int)(temp^(temp >>>(32)))));
  286. temp = Double.doubleToLongBits(topFov);
  287. result = ((prime*result)+((int)(temp^(temp >>>(32)))));
  288. temp = Double.doubleToLongBits(near);
  289. result = ((prime*result)+((int)(temp^(temp >>>(32)))));
  290. result = ((prime*result)+((viewVolumeSimpleExtension == null)? 0 :viewVolumeSimpleExtension.hashCode()));
  291. result = ((prime*result)+((viewVolumeObjectExtension == null)? 0 :viewVolumeObjectExtension.hashCode()));
  292. return result;
  293. }
  294. @Override
  295. public boolean equals(Object obj) {
  296. if (this == obj) {
  297. return true;
  298. }
  299. if (obj == null) {
  300. return false;
  301. }
  302. if (super.equals(obj) == false) {
  303. return false;
  304. }
  305. if ((obj instanceof ViewVolume) == false) {
  306. return false;
  307. }
  308. ViewVolume other = ((ViewVolume) obj);
  309. if (leftFov!= other.leftFov) {
  310. return false;
  311. }
  312. if (rightFov!= other.rightFov) {
  313. return false;
  314. }
  315. if (bottomFov!= other.bottomFov) {
  316. return false;
  317. }
  318. if (topFov!= other.topFov) {
  319. return false;
  320. }
  321. if (near!= other.near) {
  322. return false;
  323. }
  324. if (viewVolumeSimpleExtension == null) {
  325. if (other.viewVolumeSimpleExtension!= null) {
  326. return false;
  327. }
  328. } else {
  329. if (viewVolumeSimpleExtension.equals(other.viewVolumeSimpleExtension) == false) {
  330. return false;
  331. }
  332. }
  333. if (viewVolumeObjectExtension == null) {
  334. if (other.viewVolumeObjectExtension!= null) {
  335. return false;
  336. }
  337. } else {
  338. if (viewVolumeObjectExtension.equals(other.viewVolumeObjectExtension) == false) {
  339. return false;
  340. }
  341. }
  342. return true;
  343. }
  344. /**
  345. * @see viewVolumeSimpleExtension
  346. *
  347. * @param viewVolumeSimpleExtension
  348. */
  349. public void setViewVolumeSimpleExtension(final List<Object> viewVolumeSimpleExtension) {
  350. this.viewVolumeSimpleExtension = viewVolumeSimpleExtension;
  351. }
  352. /**
  353. * add a value to the viewVolumeSimpleExtension property collection
  354. *
  355. * @param viewVolumeSimpleExtension
  356. * Objects of the following type are allowed in the list: {@link Object}
  357. * @return
  358. * <tt>true</tt> (as general contract of <tt>Collection.add</tt>).
  359. */
  360. public ViewVolume addToViewVolumeSimpleExtension(final Object viewVolumeSimpleExtension) {
  361. this.getViewVolumeSimpleExtension().add(viewVolumeSimpleExtension);
  362. return this;
  363. }
  364. /**
  365. * @see viewVolumeObjectExtension
  366. *
  367. * @param viewVolumeObjectExtension
  368. */
  369. public void setViewVolumeObjectExtension(final List<AbstractObject> viewVolumeObjectExtension) {
  370. this.viewVolumeObjectExtension = viewVolumeObjectExtension;
  371. }
  372. /**
  373. * add a value to the viewVolumeObjectExtension property collection
  374. *
  375. * @param viewVolumeObjectExtension
  376. * Objects of the following type are allowed in the list: {@link AbstractObject}
  377. * @return
  378. * <tt>true</tt> (as general contract of <tt>Collection.add</tt>).
  379. */
  380. public ViewVolume addToViewVolumeObjectExtension(final AbstractObject viewVolumeObjectExtension) {
  381. this.getViewVolumeObjectExtension().add(viewVolumeObjectExtension);
  382. return this;
  383. }
  384. /**
  385. * @see objectSimpleExtension
  386. *
  387. */
  388. @Obvious
  389. @Override
  390. public void setObjectSimpleExtension(final List<Object> objectSimpleExtension) {
  391. super.setObjectSimpleExtension(objectSimpleExtension);
  392. }
  393. @Obvious
  394. @Override
  395. public ViewVolume addToObjectSimpleExtension(final Object objectSimpleExtension) {
  396. super.getObjectSimpleExtension().add(objectSimpleExtension);
  397. return this;
  398. }
  399. /**
  400. * fluent setter
  401. * @see #setLeftFov(double)
  402. *
  403. * @param leftFov
  404. * required parameter
  405. */
  406. public ViewVolume withLeftFov(final double leftFov) {
  407. this.setLeftFov(leftFov);
  408. return this;
  409. }
  410. /**
  411. * fluent setter
  412. * @see #setRightFov(double)
  413. *
  414. * @param rightFov
  415. * required parameter
  416. */
  417. public ViewVolume withRightFov(final double rightFov) {
  418. this.setRightFov(rightFov);
  419. return this;
  420. }
  421. /**
  422. * fluent setter
  423. * @see #setBottomFov(double)
  424. *
  425. * @param bottomFov
  426. * required parameter
  427. */
  428. public ViewVolume withBottomFov(final double bottomFov) {
  429. this.setBottomFov(bottomFov);
  430. return this;
  431. }
  432. /**
  433. * fluent setter
  434. * @see #setTopFov(double)
  435. *
  436. * @param topFov
  437. * required parameter
  438. */
  439. public ViewVolume withTopFov(final double topFov) {
  440. this.setTopFov(topFov);
  441. return this;
  442. }
  443. /**
  444. * fluent setter
  445. * @see #setNear(double)
  446. *
  447. * @param near
  448. * required parameter
  449. */
  450. public ViewVolume withNear(final double near) {
  451. this.setNear(near);
  452. return this;
  453. }
  454. /**
  455. * fluent setter
  456. * @see #setViewVolumeSimpleExtension(List<Object>)
  457. *
  458. * @param viewVolumeSimpleExtension
  459. * required parameter
  460. */
  461. public ViewVolume withViewVolumeSimpleExtension(final List<Object> viewVolumeSimpleExtension) {
  462. this.setViewVolumeSimpleExtension(viewVolumeSimpleExtension);
  463. return this;
  464. }
  465. /**
  466. * fluent setter
  467. * @see #setViewVolumeObjectExtension(List<AbstractObject>)
  468. *
  469. * @param viewVolumeObjectExtension
  470. * required parameter
  471. */
  472. public ViewVolume withViewVolumeObjectExtension(final List<AbstractObject> viewVolumeObjectExtension) {
  473. this.setViewVolumeObjectExtension(viewVolumeObjectExtension);
  474. return this;
  475. }
  476. @Obvious
  477. @Override
  478. public ViewVolume withObjectSimpleExtension(final List<Object> objectSimpleExtension) {
  479. super.withObjectSimpleExtension(objectSimpleExtension);
  480. return this;
  481. }
  482. @Obvious
  483. @Override
  484. public ViewVolume withId(final String id) {
  485. super.withId(id);
  486. return this;
  487. }
  488. @Obvious
  489. @Override
  490. public ViewVolume withTargetId(final String targetId) {
  491. super.withTargetId(targetId);
  492. return this;
  493. }
  494. @Override
  495. public ViewVolume clone() {
  496. ViewVolume copy;
  497. copy = ((ViewVolume) super.clone());
  498. copy.viewVolumeSimpleExtension = new ArrayList<Object>((getViewVolumeSimpleExtension().size()));
  499. for (Object iter: viewVolumeSimpleExtension) {
  500. copy.viewVolumeSimpleExtension.add(iter);
  501. }
  502. copy.viewVolumeObjectExtension = new ArrayList<AbstractObject>((getViewVolumeObjectExtension().size()));
  503. for (AbstractObject iter: viewVolumeObjectExtension) {
  504. copy.viewVolumeObjectExtension.add(iter.clone());
  505. }
  506. return copy;
  507. }
  508. }