function [output] = mod_ge_point(X,Y,Z,varargin)
%
% % Please use the link below to view the documentation.
% % If you don't see the link which is automatically inserted by MATLAB,
% % try removing the line break above, so that this help block is merged
% % with the previous one.
% % Reference page in help browser: ge_point
% etm modifications include changing table header from variable to
% parameter
AuthorizedOptions = authoptions( 'ge_point' );
altitudeMode = 'relativeToSeaFloor';
dataFormatStr = '%g';
tableBorderWidth = 1;
% description: see below;
extrude = 0;
iconColor = 'FFFFFFFF';
iconScale = 1.0;
iconURL = ' ';
id = 'point';
idTag = 'id';
msgToScreen = false;
snippet = ' ';
% lineColor = 'ffffffff';
% lineWidth = 1.0;
name = '';
timeStamp = ' ';
timeSpanStart = ' ';
timeSpanStop = ' ';
visibility = 1;
%iconLabels = ...
pointDataCell = {};
parsepairs %script that parses Parameter/Value pairs.
if msgToScreen
disp(['Running: ',mfilename,'...'])
end
htmlTableChars = '';
if numel(X)==1
timeEntryChars = '';
if ~strcmp(timeSpanStart,' ')
timeEntryChars = [timeEntryChars,'
| tStart | ',timeSpanStart,' |
'];
end
if ~strcmp(timeSpanStop,' ')
timeEntryChars = [timeEntryChars,'| tStop | ',timeSpanStop,' |
'];
end
if isempty(pointDataCell)
description = ['| Parameter | Value |
',...
'| longitude [decimal degrees] | ',num2str(X,dataFormatStr),' |
',...
'| latitude [decimal degrees] | ',num2str(Y,dataFormatStr),' |
',...
'| elevation [m] | ',num2str(Z,dataFormatStr),' |
',...
timeEntryChars,htmlTableChars,...
'
'];
else
for r=1:size(pointDataCell,1)
htmlTableChars = [htmlTableChars,'| ',pointDataCell{r,1},' | ',pointDataCell{r,2},' |
'];
end
description = ['| Parameter | Value |
',...
htmlTableChars,...
'
'];
end
else
description = '';
end
if( isempty( X ) || isempty( Y ) || isempty(Z) )
error('empty coordinates passed to ge_point(...).');
else
if ~isequal(size(X(:)),size(Y(:)))
error(['Coordinate vectors of different length passed' 10 'to function: ' 39 mfilename 39 '.'])
else
coords(:,1) = X;
coords(:,2) = Y;
coords(:,3) = Z;
end
end
if ~(isequal(altitudeMode,'clampToGround')||...
isequal(altitudeMode,'relativeToSeaFloor')||...
isequal(altitudeMode,'relativeToGround')||...
isequal(altitudeMode,'absolute'))
error(['Parameter ',39,'altitudeMode',39, ' should be one of ' ,39,'clampToGround',39,', ',10,39,'relativeToGround',39,', or ',39,'absolute',39,'.' ])
end
id_chars = [ idTag '="' id '"' ];
poly_id_chars = [ idTag '="point_' id '"' ];
name_chars = [ '',10,name,10,'',10 ];
style_chars = [ '#displayInfo',10 ];
if snippet == ' '
snippet_chars = '';
else
snippet_chars = [ '' snippet '',10 ];
end
description_chars = [ '',10,'',10,'',10 ];
visibility_chars = [ '',10,int2str(visibility),10,'',10];
% lineColor_chars = [ '',10, lineColor ,10,'',10 ];
% lineWidth_chars= [ '',10, num2str(lineWidth, '%.2f') ,10,'',10 ];
extrude_chars = [ '' int2str(extrude) '',10 ];
if iconURL == ' '
icon_chars = '';
else
icon_chars = [ ...
'',10,...
'' iconColor '',10,...
'' num2str(iconScale) '',10,...
'',10,...
'' iconURL '',10,...
'',10, ...
'' ];
end
if timeStamp == ' '
timeStamp_chars = '';
else
timeStamp_chars = [ '' timeStamp '',10 ];
end
if timeSpanStart == ' '
timeSpan_chars = '';
else
if timeSpanStop == ' '
timeSpan_chars = [ '' timeSpanStart '',10 ];
else
timeSpan_chars = [ '' timeSpanStart '' timeSpanStop '',10 ];
end
end
header=['',10,...
name_chars,10,...
style_chars,10,...
timeStamp_chars,...
timeSpan_chars,...
visibility_chars,10,...
snippet_chars,...
description_chars,10,...
'',10,...
'',10,...
'',altitudeMode,'',10,...
'',10,'1',10,'',10,...
extrude_chars,10,...
'',10];
footer = ['',10,...
10,'',10,...
10,'',10];
%path plot or not
len = length(coords(:,1,1));
output = '';
if length( coords(:,1) ) > 1
for x = 1:len
if ~isnan(coords(x,1))
coordinates = conv_coord(coords(x,:));
output = [ output, header, coordinates, footer ];
end
end
else
if ~isnan(coords)
coordinates = conv_coord(coords);
output = [ header, coordinates, footer];
end
end
if msgToScreen
disp(['Running: ',mfilename,'...Done'])
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS START HERE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function s = conv_coord(M)
%% conv_coord(M)
% helper function to conver decimal degree coordinates into character array
s=[];
for r=1:size(M,1)
for c=1:size(M,2)
s = [s,sprintf('%.6f',M(r,c))];
s = trim_trail_zero(s);
if c==size(M,2)
s=[s,10];
else
s=[s,','];
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function s_out = trim_trail_zero(s_in)
% helper function meant to trim trailing character zeros from a character
% array.
dig = 1;
L = length(s_in);
last_char = s_in(L);
cont = true;
while (strcmp(last_char,'0') | strcmp(last_char,'.')) & cont==1
if strcmp((last_char),'.')
cont = 0;
end
s_in = s_in(1:L-dig);
last_char = s_in(length(s_in));
dig = dig+1;
end
s_out = s_in;