vizLayer_animatorBase.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="utf-8">
  8. <title data-i18n="resources.title_animatorBase"></title>
  9. <style type="text/css">
  10. body {
  11. margin: 0;
  12. overflow: hidden;
  13. background: #fff;
  14. width: 100%;
  15. height: 100%
  16. }
  17. #map {
  18. position: absolute;
  19. width: 100%;
  20. height: 100%;
  21. }
  22. #toolbar {
  23. position: absolute;
  24. top: 50px;
  25. right: 10px;
  26. width: 220px;
  27. text-align: center;
  28. z-index: 100;
  29. border-radius: 4px;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div id="toolbar" class="panel panel-primary">
  35. <div class='panel-heading'>
  36. <h5 class='panel-title text-center' data-i18n="resources.title_animatorBase"></h5></div>
  37. <div class='panel-body content'>
  38. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_start" onclick="startAnimator()"/>&nbsp; &nbsp;
  39. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_pause" onclick="pauseAnimator()"/>
  40. </div>
  41. </div>
  42. <div id="map"></div>
  43. <script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
  44. <script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
  45. <script>
  46. var map, layer, animatorVector;
  47. var style =
  48. {
  49. fillColor: "#339933",
  50. fillOpacity: 1,
  51. strokeOpacity: 0,
  52. pointRadius: 5
  53. };
  54. init();
  55. function init() {
  56. if (!document.createElement('canvas').getContext) {
  57. widgets.alert.showAlert(resources.msg_supportCanvas, false);
  58. return;
  59. }
  60. map = new SuperMap.Map("map", {
  61. controls: [
  62. new SuperMap.Control.ScaleLine(),
  63. new SuperMap.Control.Zoom(),
  64. new SuperMap.Control.MousePosition(),
  65. new SuperMap.Control.Navigation({
  66. dragPanOptions: {
  67. enableKinetic: true
  68. }
  69. })]
  70. });
  71. map.addControl(new SuperMap.Control.LayerSwitcher(), new SuperMap.Pixel(42, 80));
  72. layer = new SuperMap.Layer.CloudLayer();
  73. map.addLayers([layer]);
  74. map.setCenter(new SuperMap.LonLat(0, 0), 1);
  75. animatorVector = new SuperMap.Layer.AnimatorVector("Vector Layer", {}, {
  76. speed: 0.2,
  77. startTime: 0,
  78. endTime: 100
  79. });
  80. map.addLayers([animatorVector]);
  81. addPolygon();
  82. }
  83. function addPolygon() {
  84. //增加点的渐变渲染,点位置改变
  85. animatorVector.addFeatures(
  86. [
  87. new SuperMap.Feature.Vector(
  88. new SuperMap.Geometry.Point(0, 0),
  89. {
  90. FEATUREID: 0,
  91. TIME: 0
  92. }
  93. ),
  94. new SuperMap.Feature.Vector(
  95. new SuperMap.Geometry.Point(5000000, 0),
  96. {
  97. FEATUREID: 0,
  98. TIME: 100
  99. }
  100. )
  101. ]
  102. );
  103. //增加线的渐变,节点数改变
  104. animatorVector.addFeatures(
  105. [
  106. new SuperMap.Feature.Vector(
  107. new SuperMap.Geometry.LineString([
  108. new SuperMap.Geometry.Point(0, 5000000),
  109. new SuperMap.Geometry.Point(-2500000, 7500000),
  110. new SuperMap.Geometry.Point(0, 10000000)
  111. ]),
  112. {
  113. FEATUREID: 1,
  114. TIME: 0
  115. }
  116. ),
  117. new SuperMap.Feature.Vector(
  118. new SuperMap.Geometry.LineString([
  119. new SuperMap.Geometry.Point(5000000, 5000000),
  120. new SuperMap.Geometry.Point(2500000, 6250000),
  121. new SuperMap.Geometry.Point(4000000, 7500000),
  122. new SuperMap.Geometry.Point(2500000, 8750000),
  123. new SuperMap.Geometry.Point(5000000, 10000000)
  124. ]),
  125. {
  126. FEATUREID: 1,
  127. TIME: 100
  128. }
  129. )
  130. ]
  131. )
  132. //增加面的渐变,节点数改变
  133. animatorVector.addFeatures(
  134. [
  135. new SuperMap.Feature.Vector(
  136. new SuperMap.Geometry.Polygon([
  137. new SuperMap.Geometry.LinearRing([
  138. new SuperMap.Geometry.Point(0, 0),
  139. new SuperMap.Geometry.Point(5000000, 0),
  140. new SuperMap.Geometry.Point(5000000, 5000000),
  141. new SuperMap.Geometry.Point(0, 5000000),
  142. new SuperMap.Geometry.Point(0, 0)
  143. ])
  144. ]),
  145. {
  146. FEATUREID: 2,
  147. TIME: 0
  148. }
  149. ),
  150. new SuperMap.Feature.Vector(
  151. new SuperMap.Geometry.Polygon([
  152. new SuperMap.Geometry.LinearRing([
  153. new SuperMap.Geometry.Point(0, 0),
  154. new SuperMap.Geometry.Point(5000000, 0),
  155. new SuperMap.Geometry.Point(2500000, 5000000),
  156. new SuperMap.Geometry.Point(0, 0)
  157. ])
  158. ]),
  159. {
  160. FEATUREID: 2,
  161. TIME: 100
  162. }
  163. )
  164. ]
  165. )
  166. }
  167. function startAnimator() {
  168. animatorVector.animator.start();
  169. }
  170. function pauseAnimator() {
  171. animatorVector.animator.pause();
  172. }
  173. </script>
  174. </body>
  175. </html>