@@ -601,18 +601,13 @@ define([
601
601
this . _shadowVolume = defaultValue ( options . shadowVolume , false ) ;
602
602
this . _workerName = 'createPolygonGeometry' ;
603
603
604
- var positions = polygonHierarchy . positions ;
605
- if ( ! defined ( positions ) || positions . length < 3 ) {
606
- this . _rectangle = new Rectangle ( ) ;
607
- } else {
608
- this . _rectangle = Rectangle . fromCartesianArray ( positions , ellipsoid ) ;
609
- }
604
+ this . _rectangle = undefined ;
610
605
611
606
/**
612
607
* The number of elements used to pack the object into an array.
613
608
* @type {Number }
614
609
*/
615
- this . packedLength = PolygonGeometryLibrary . computeHierarchyPackedLength ( polygonHierarchy ) + Ellipsoid . packedLength + VertexFormat . packedLength + Rectangle . packedLength + 10 ;
610
+ this . packedLength = PolygonGeometryLibrary . computeHierarchyPackedLength ( polygonHierarchy ) + Ellipsoid . packedLength + VertexFormat . packedLength + 10 ;
616
611
}
617
612
618
613
/**
@@ -696,9 +691,6 @@ define([
696
691
VertexFormat . pack ( value . _vertexFormat , array , startingIndex ) ;
697
692
startingIndex += VertexFormat . packedLength ;
698
693
699
- Rectangle . pack ( value . _rectangle , array , startingIndex ) ;
700
- startingIndex += Rectangle . packedLength ;
701
-
702
694
array [ startingIndex ++ ] = value . _height ;
703
695
array [ startingIndex ++ ] = value . _extrudedHeight ;
704
696
array [ startingIndex ++ ] = value . _granularity ;
@@ -715,7 +707,6 @@ define([
715
707
716
708
var scratchEllipsoid = Ellipsoid . clone ( Ellipsoid . UNIT_SPHERE ) ;
717
709
var scratchVertexFormat = new VertexFormat ( ) ;
718
- var scratchRectangle = new Rectangle ( ) ;
719
710
720
711
//Only used to avoid inaability to default construct.
721
712
var dummyOptions = {
@@ -746,9 +737,6 @@ define([
746
737
var vertexFormat = VertexFormat . unpack ( array , startingIndex , scratchVertexFormat ) ;
747
738
startingIndex += VertexFormat . packedLength ;
748
739
749
- var rectangle = Rectangle . unpack ( array , startingIndex , scratchRectangle ) ;
750
- startingIndex += Rectangle . packedLength ;
751
-
752
740
var height = array [ startingIndex ++ ] ;
753
741
var extrudedHeight = array [ startingIndex ++ ] ;
754
742
var granularity = array [ startingIndex ++ ] ;
@@ -775,7 +763,6 @@ define([
775
763
result . _perPositionHeight = perPositionHeight ;
776
764
result . _closeTop = closeTop ;
777
765
result . _closeBottom = closeBottom ;
778
- result . _rectangle = Rectangle . clone ( rectangle ) ;
779
766
result . _shadowVolume = shadowVolume ;
780
767
result . packedLength = packedLength ;
781
768
return result ;
@@ -931,6 +918,15 @@ define([
931
918
*/
932
919
rectangle : {
933
920
get : function ( ) {
921
+ if ( ! defined ( this . _rectangle ) ) {
922
+ var positions = this . _polygonHierarchy . positions ;
923
+ if ( ! defined ( positions ) || positions . length < 3 ) {
924
+ this . _rectangle = new Rectangle ( ) ;
925
+ } else {
926
+ this . _rectangle = Rectangle . fromCartesianArray ( positions , this . _ellipsoid ) ;
927
+ }
928
+ }
929
+
934
930
return this . _rectangle ;
935
931
}
936
932
}
0 commit comments