Changeset 6466
- Timestamp:
- 11/02/10 10:32:57 (14 years ago)
- Location:
- issm/trunk/src/m/kml
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/kml/kml_part_edges.m
r6461 r6466 108 108 kfold.descript =sprintf('Partitions=%d, Nodes=%d',... 109 109 md.npart,md.numberofgrids); 110 kfold.feature ={repmat(kml_placemark(), 0,0)};111 112 % write each partition loop as a linestringplacemark110 kfold.feature ={repmat(kml_placemark(),1,md.npart)}; 111 112 % write each partition as a linestring multigeometry placemark 113 113 114 114 disp(['Writing ' num2str(md.npart) ' partitions as KML linestrings.']); … … 152 152 end 153 153 154 % set up the placemark with multigeometry 155 156 kplace=kml_placemark(); 157 if (length(iloop)-1 > 1) 158 kplace.name =sprintf('Partition %d (%d loops)',k,length(iloop)-1); 159 else 160 kplace.name =sprintf('Partition %d',k); 161 end 162 kplace.visibility=1; 163 if exist('pdata','var') 164 kplace.descript =sprintf('Partition data: %g',pdata(k)); 165 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 166 if (imap >= 1) && (imap <= size(cmap,1)) 167 kplace.styleurl =sprintf('#MatlabColor%d',imap); 168 elseif (pdata(k) == cmax) 169 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 170 else 171 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 172 end 173 else 174 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 175 end 176 177 kmgeom=kml_multigeometry(); 178 kmgeom.geometry ={repmat(kml_linestring(),1,length(iloop)-1)}; 179 154 180 % loop over each loop of the perimeter for the given partition 155 181 156 182 for i=1:length(iloop)-1 157 kplace=kml_placemark();158 if (length(iloop)-1 > 1)159 kplace.name =sprintf('Partition %d, Loop %d',k,i);160 else161 kplace.name =sprintf('Partition %d',k);162 end163 kplace.visibility=1;164 if exist('pdata','var')165 kplace.descript =sprintf('Partition data: %g',pdata(k));166 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1;167 if (imap >= 1) && (imap <= size(cmap,1))168 kplace.styleurl =sprintf('#MatlabColor%d',imap);169 elseif (pdata(k) == cmax)170 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1));171 else172 kplace.styleurl =sprintf('#BlackLineEmptyPoly');173 end174 else175 kplace.styleurl =sprintf('#BlackLineRandomPoly');176 end177 178 183 kline=kml_linestring(); 179 184 kline.extrude =1; … … 454 459 end 455 460 456 kplace.geometry=kline; 457 kfold.feature{1}(end+1)=kplace; 458 clear kline kplace 459 end 460 end 461 end 462 463 end 464 461 kmgeom.geometry{1}(i)=kline; 462 clear kline 463 end 464 465 kplace.geometry=kmgeom; 466 kfold.feature{1}(k)=kplace; 467 clear kmgeom kplace 468 end 469 end 470 471 end 472 -
issm/trunk/src/m/kml/kml_part_elems.m
r6461 r6466 108 108 kfold.descript =sprintf('Partitions=%d, Nodes=%d\n',... 109 109 md.npart,md.numberofgrids); 110 kfold.feature ={repmat(kml_placemark(), 0,0)};111 112 % write each partition loop as a polygon placemark110 kfold.feature ={repmat(kml_placemark(),1,md.npart)}; 111 112 % write each partition loop as a polygon multigeometry placemark 113 113 114 114 disp(['Writing ' num2str(md.npart) ' partitions as KML polygons.']); … … 118 118 pdata(:)=NaN; 119 119 end 120 121 % loop over each partition 122 120 123 for k=1:md.npart 124 125 % for each partition, find all the included elements and determine the 126 % perimeter (including those shared by another partition) 127 121 128 [icol,irow]=find(epart'==k); 122 129 irow=unique(irow); … … 125 132 [edgeper,elemper,iloop]=edgeperimeter(elem,nodecon); 126 133 iloop(end+1)=size(edgeper,1)+1; 134 135 % determine the data to be used for the colors (if any) 136 127 137 if exist('ndata','var') 128 138 pdata(k)=ndata(find(md.part+1==k,1)); … … 138 148 end 139 149 end 150 151 % set up the placemark with multigeometry 152 153 kplace=kml_placemark(); 154 if (length(iloop)-1 > 1) 155 kplace.name =sprintf('Partition %d (%d loops)',k,length(iloop)-1); 156 else 157 kplace.name =sprintf('Partition %d',k); 158 end 159 kplace.visibility=1; 160 if exist('pdata','var') 161 kplace.descript =sprintf('Partition data: %g',pdata(k)); 162 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 163 if (imap >= 1) && (imap <= size(cmap,1)) 164 kplace.styleurl =sprintf('#MatlabColor%d',imap); 165 elseif (pdata(k) == cmax) 166 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 167 else 168 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 169 end 170 else 171 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 172 end 173 174 kmgeom=kml_multigeometry(); 175 kmgeom.geometry ={repmat(kml_polygon(),1,length(iloop)-1)}; 176 177 % loop over each loop of the perimeter for the given partition 178 140 179 for i=1:length(iloop)-1 141 kplace=kml_placemark();142 if (length(iloop)-1 > 1)143 kplace.name =sprintf('Partition %d, Loop %d',k,i);144 else145 kplace.name =sprintf('Partition %d',k);146 end147 kplace.visibility=1;148 if exist('pdata','var')149 kplace.descript =sprintf('Partition data: %g',pdata(k));150 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1;151 if (imap >= 1) && (imap <= size(cmap,1))152 kplace.styleurl =sprintf('#MatlabColor%d',imap);153 elseif (pdata(k) == cmax)154 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1));155 else156 kplace.styleurl =sprintf('#BlackLineEmptyPoly');157 end158 else159 kplace.styleurl =sprintf('#BlackLineRandomPoly');160 end161 162 180 kpoly=kml_polygon(); 163 181 kpoly.extrude =1; … … 167 185 kring.coords =zeros(iloop(i+1)-iloop(i)+1,3); 168 186 187 % loop over the element edges on the loop of the partition 188 169 189 for j=iloop(i):iloop(i+1)-1 170 190 [lat,long]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s'); … … 174 194 175 195 kpoly.outer=kring; 176 kplace.geometry=kpoly; 177 kfold.feature{1}(end+1)=kplace; 178 clear kring kpoly kplace 179 end 180 end 181 end 182 183 end 184 196 kmgeom.geometry{1}(i)=kpoly; 197 clear kring kpoly 198 end 199 200 kplace.geometry=kmgeom; 201 kfold.feature{1}(k)=kplace; 202 clear kmgeom kplace 203 end 204 end 205 206 end 207 -
issm/trunk/src/m/kml/kml_partitions.m
r6461 r6466 109 109 kfold.descript =sprintf('Partitions=%d, Nodes=%d',... 110 110 md.npart,md.numberofgrids); 111 kfold.feature ={repmat(kml_placemark(), 0,0)};112 113 % write each partition loop as polygonplacemark111 kfold.feature ={repmat(kml_placemark(),1,md.npart)}; 112 113 % write each partition as a polygon multigeometry placemark 114 114 115 115 disp(['Writing ' num2str(md.npart) ' partitions as KML polygons.']); … … 136 136 [edgeper,elemper,iloop]=edgeperimeter(elemp,nodeconp,edgeadjp); 137 137 iloop(end+1)=size(edgeper,1)+1; 138 138 139 139 % determine the data to be used for the colors (if any) 140 140 … … 153 153 end 154 154 155 % set up the placemark with multigeometry 156 157 kplace=kml_placemark(); 158 if (length(iloop)-1 > 1) 159 kplace.name =sprintf('Partition %d (%d loops)',k,length(iloop)-1); 160 else 161 kplace.name =sprintf('Partition %d',k); 162 end 163 kplace.visibility=1; 164 if exist('pdata','var') 165 kplace.descript =sprintf('Partition data: %g',pdata(k)); 166 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 167 if (imap >= 1) && (imap <= size(cmap,1)) 168 kplace.styleurl =sprintf('#MatlabColor%d',imap); 169 elseif (pdata(k) == cmax) 170 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 171 else 172 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 173 end 174 else 175 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 176 end 177 178 kmgeom=kml_multigeometry(); 179 kmgeom.geometry ={repmat(kml_polygon(),1,length(iloop)-1)}; 180 155 181 % loop over each loop of the perimeter for the given partition 156 182 157 183 for i=1:length(iloop)-1 158 kplace=kml_placemark();159 if (length(iloop)-1 > 1)160 kplace.name =sprintf('Partition %d, Loop %d',k,i);161 else162 kplace.name =sprintf('Partition %d',k);163 end164 kplace.visibility=1;165 if exist('pdata','var')166 kplace.descript =sprintf('Partition data: %g',pdata(k));167 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1;168 if (imap >= 1) && (imap <= size(cmap,1))169 kplace.styleurl =sprintf('#MatlabColor%d',imap);170 elseif (pdata(k) == cmax)171 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1));172 else173 kplace.styleurl =sprintf('#BlackLineEmptyPoly');174 end175 else176 kplace.styleurl =sprintf('#BlackLineRandomPoly');177 end178 179 184 kpoly=kml_polygon(); 180 185 kpoly.extrude =1; … … 457 462 458 463 kpoly.outer=kring; 459 kplace.geometry=kpoly; 460 kfold.feature{1}(end+1)=kplace; 461 clear kring kpoly kplace 462 end 463 end 464 end 465 466 end 467 464 kmgeom.geometry{1}(i)=kpoly; 465 clear kring kpoly 466 end 467 468 kplace.geometry=kmgeom; 469 kfold.feature{1}(k)=kplace; 470 clear kmgeom kplace 471 end 472 end 473 474 end 475
Note:
See TracChangeset
for help on using the changeset viewer.