[26740] | 1 | Index: ../trunk-jpl/src/m/shp/shp2exp.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/shp/shp2exp.m (revision 26630)
|
---|
| 4 | +++ ../trunk-jpl/src/m/shp/shp2exp.m (revision 26631)
|
---|
| 5 | @@ -47,19 +47,30 @@
|
---|
| 6 | end
|
---|
| 7 | elseif strcmpi(shp(i).Geometry,'Point'),
|
---|
| 8 | x=shp(i).X; y=shp(i).Y;
|
---|
| 9 | - expstruct(end+1).x=x;
|
---|
| 10 | - expstruct(end).y=y;
|
---|
| 11 | - expstruct(end).nods=length(x);
|
---|
| 12 | - expstruct(end).density=1;
|
---|
| 13 | - expstruct(end).closed=0;
|
---|
| 14 | - %exp(end).name=num2str(shp(i).id);
|
---|
| 15 | + if ~isnan(x) && ~isnan(y)
|
---|
| 16 | + expstruct(end+1).x=x;
|
---|
| 17 | + expstruct(end).y=y;
|
---|
| 18 | + expstruct(end).nods=length(x);
|
---|
| 19 | + expstruct(end).density=1;
|
---|
| 20 | + expstruct(end).closed=0;
|
---|
| 21 | + %exp(end).name=num2str(shp(i).id);
|
---|
| 22 | + end
|
---|
| 23 | + elseif strcmpi(shp(i).Geometry,'PointZ'),
|
---|
| 24 | + shp(i)
|
---|
| 25 | elseif strcmpi(shp(i).Geometry,'Line'),
|
---|
| 26 | - x=shp(i).X; y=shp(i).Y;
|
---|
| 27 | - expstruct(end+1).x=x;
|
---|
| 28 | - expstruct(end).y=y;
|
---|
| 29 | - expstruct(end).nods=length(x);
|
---|
| 30 | - expstruct(end).density=1;
|
---|
| 31 | - expstruct(end).closed=0;
|
---|
| 32 | + x=shp(i).X(:); y=shp(i).Y(:);
|
---|
| 33 | + pos = find(~isnan(x) & ~isnan(y));
|
---|
| 34 | + idx=find(diff(pos)~=1);
|
---|
| 35 | + A=[idx(1);diff(idx);numel(pos)-idx(end)];
|
---|
| 36 | + Cx=mat2cell(x(pos),A,1);
|
---|
| 37 | + Cy=mat2cell(y(pos),A,1);
|
---|
| 38 | + for i=1:numel(Cx)
|
---|
| 39 | + expstruct(end+1).x=Cx{i};
|
---|
| 40 | + expstruct(end).y=Cy{i};
|
---|
| 41 | + expstruct(end).nods=length(Cx{i});
|
---|
| 42 | + expstruct(end).density=1;
|
---|
| 43 | + expstruct(end).closed=0;
|
---|
| 44 | + end
|
---|
| 45 | end
|
---|
| 46 | end
|
---|
| 47 |
|
---|