Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-09-29 Thread Alan W. Irwin

On 2017-09-28 21:31+0100 Phil Rosenberg wrote:


Hi Mark and anyone else who is listening
I have just fixed the map plots. Apologies that this has taken
sooo long. The changes have just been pushed to the development
version and have been checked on my windows machine. Note that you
were correct also about there being an issue with using plmapfill. It
turned out that the type specified in the shapefile was overriding the
render type specified by the user.

While I was there I realised there was a problem with rendering
polygons that wrap round the whole globe such as Antarctica so that
should now be fixed too.



@Mark:

Thanks for spotting these issues that Phil just fixed.

For your information, the git master branch version (what Phil just
pushed) includes an earlier change by me where all the deprecated
plmap cruft was removed.

@Phil:

After fixing up some minor style and trailing space issues (commit
e60fba8 which I just pushed), I tested your changes in the build tree
and for the shared libraries case on Linux using the -DBUILD_TEST=ON
option.  My build of the test_noninteractive target (which build
PLplot libraries, bindings, devices, and examples and which executes
each of our file devices for each of our C examples as well as
comparing -dev psc results for all our supported languages) continues
to work well.  That is, there are no obvious configure, build, or
run-time issue, and no regressions on the remaining (OCaml) PostScript
differences with C example results. I also ran

examples/c/x19c -dev xcairo

, and there are no obvious rendering issues in those results (and
presumably also for all other devices/languages).  I also
built the "validate" target (which tests your DocBook documentation
changes for any validation errors) without issues.

In sum, your current set of changes looks fine to me, and thanks for
this effort!


For those who may now how plfill works a bit better than me, something
that is supported by shapefiles, but currently not by plmap, is holes.
A polygon in a shapefile consists of multiple parts and clockwise
parts are filled whereas anticlockwise parts are holes. Is this
something we can do relatively easily with plfill or is it not really
doable?


I don't think that such a major change to plfill would be a good idea.
For example, calls to plsurf3d (example 8) and plshades (example 16)
end up at the lowest level as many different calls to plfill where
presumably some end up as anti-clockwise fills and some end up
as clockwise fills in difficult-to-predict ways.

Therefore, would it be possible for you to honor this shapefile
convention by simply not calling plfill from inside the plmap*
routines whenever they run into an anticlockwise part and by
changing our DocBook documentation of those routines appropriately?

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-09-29 Thread Mark de Wever

Hi Phil,

On 28.9.17 22:31, Phil Rosenberg wrote:

I have just fixed the map plots. Apologies that this has taken
sooo long. The changes have just been pushed to the development
version and have been checked on my windows machine. Note that you
were correct also about there being an issue with using plmapfill. It
turned out that the type specified in the shapefile was overriding the
render type specified by the user.


Thanks for the fixes.

I just tested with HEAD and the polygon code no longer crashes.

Next I wanted to test with a map with lines and no fill. Unfortunately 
plmapline also draws filled polygons. I did this test with the same 
shapefiles [1] as the original test.


I assume it is caused by the code: src/plmap.c:324
if ( shapetype == SHPT_NULL ) 

{ 

shapetype = fileShapeType; 

} 




The attached patch lets plmapline draw lines instead of filled polygons.

I tested HEAD+patch and the coastal lines no longer disappear, so that 
issue is also fixed.


I will do more testing next week, thanks again for the fixes.


[1] 
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries_lakes.zip


Regards,
Mark de Wever
diff --git a/src/plmap.c b/src/plmap.c
index 58d359a99..694e23fce 100644
--- a/src/plmap.c
+++ b/src/plmap.c
@@ -596,7 +596,7 @@ plmapline( PLMAPFORM_callback mapform, PLCHAR_VECTOR name,
PLINT_VECTOR plotentries, PLINT nplotentries )
 {
 #ifdef HAVE_SHAPELIB
-drawmap( mapform, name, 0.0, 0.0, SHPT_NULL, 0.0, "", minx, maxx,
+drawmap( mapform, name, 0.0, 0.0, SHPT_ARC, 0.0, "", minx, maxx,
 miny, maxy, plotentries, nplotentries );
 #else
 plwarn( "plmapline is a no-op because shapelib is not available." );
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-09-29 Thread Phil Rosenberg
Hi Mark, well spotted. Patch applied. Thanks for the contribution.

On 29 September 2017 at 11:00, Mark de Wever  wrote:
> Hi Phil,
>
> On 28.9.17 22:31, Phil Rosenberg wrote:
>>
>> I have just fixed the map plots. Apologies that this has taken
>> sooo long. The changes have just been pushed to the development
>> version and have been checked on my windows machine. Note that you
>> were correct also about there being an issue with using plmapfill. It
>> turned out that the type specified in the shapefile was overriding the
>> render type specified by the user.
>
>
> Thanks for the fixes.
>
> I just tested with HEAD and the polygon code no longer crashes.
>
> Next I wanted to test with a map with lines and no fill. Unfortunately
> plmapline also draws filled polygons. I did this test with the same
> shapefiles [1] as the original test.
>
> I assume it is caused by the code: src/plmap.c:324
> if ( shapetype == SHPT_NULL )
> {
> shapetype = fileShapeType;
> }
>
>
> The attached patch lets plmapline draw lines instead of filled polygons.
>
> I tested HEAD+patch and the coastal lines no longer disappear, so that issue
> is also fixed.
>
> I will do more testing next week, thanks again for the fixes.
>
>
> [1]
> http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries_lakes.zip
>
> Regards,
> Mark de Wever

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-09-28 Thread Phil Rosenberg
Hi Mark and anyone else who is listening
I have just fixed the map plots. Apologies that this has taken
sooo long. The changes have just been pushed to the development
version and have been checked on my windows machine. Note that you
were correct also about there being an issue with using plmapfill. It
turned out that the type specified in the shapefile was overriding the
render type specified by the user.

While I was there I realised there was a problem with rendering
polygons that wrap round the whole globe such as Antarctica so that
should now be fixed too.

For those who may now how plfill works a bit better than me, something
that is supported by shapefiles, but currently not by plmap, is holes.
A polygon in a shapefile consists of multiple parts and clockwise
parts are filled whereas anticlockwise parts are holes. Is this
something we can do relatively easily with plfill or is it not really
doable?

Phil

On 18 November 2016 at 10:41, Mark de Wever  wrote:
> Hi,
>
> Recently I ran into an issue with the plplot 5.11.1 on Windows. The plmap
> code seems to omit lines entirely when a part of the line is not visible.
> This only occurs when the line is not visible on the left hand side of the
> plot. When a part is not visible on the right hand side it is properly
> shown.
>
> At my Debian Stable system I use the system's 5.10.0 version. There the
> issue doesn't occur. (I noticed the plmap code has been rewritten between
> 5.10.0 and 5.11.0.) I also tested the bug on Debian Stable with 5.11.1 and a
> recent master [d71e48], both have the issue.
>
> Attached a modified example 19 where the bug is shown. The first plot shows
> the entire coast of Ireland. The second plot should only omit a small part
> of the coast, but instead the entire coast has been removed. Only the
> internal border of Ireland remains visible. This seems to happen with all
> coast lines; I picked Ireland since it shows the bug nicely.
>
>
> Regards,
> Mark de Wever
>
> PS: It seems the old deprecated plmap code no longer shows a map (at least
> on Windows). I didn't investigate further, I just installed the shapelib
> library.
>
> PPS: There also seems to be another issue with a filled polygon map, but I'm
> still investigating. If it really is an issue, I'll report it.
>
> --
>
> ___
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel
>

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-07-24 Thread Phil Rosenberg
Hi Mark
Thanks for the reminder. I will definitely put as much effort as I can
into getting this sorted pre release.

Phil

On 24 July 2017 at 13:27, Mark de Wever  wrote:
> Hi Phil,
>
> I saw the release of 5.13 is being planned. I wondered whether it is
> possible to fix this issue before the release.
>
> Regards,
> Mark de Wever
>
>
> On 18.11.16 18:30, p.d.rosenb...@gmail.com wrote:
>>
>> Hi Mark
>> Thanks for the report. I'll have a look at your example over the weekend
>> and see if I can fix the issue.
>>
>> Phil
>>
>> Sent from my Windows 10 phone
>>
>> From: Mark de Wever
>> Sent: 18 November 2016 11:06
>> To: plplot-dev
>> Subject: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of
>> themap
>>
>> Hi,
>>
>> Recently I ran into an issue with the plplot 5.11.1 on Windows. The
>> plmap code seems to omit lines entirely when a part of the line is not
>> visible. This only occurs when the line is not visible on the left hand
>> side of the plot. When a part is not visible on the right hand side it
>> is properly shown.
>>
>> At my Debian Stable system I use the system's 5.10.0 version. There the
>> issue doesn't occur. (I noticed the plmap code has been rewritten
>> between 5.10.0 and 5.11.0.) I also tested the bug on Debian Stable with
>> 5.11.1 and a recent master [d71e48], both have the issue.
>>
>> Attached a modified example 19 where the bug is shown. The first plot
>> shows the entire coast of Ireland. The second plot should only omit a
>> small part of the coast, but instead the entire coast has been removed.
>> Only the internal border of Ireland remains visible. This seems to
>> happen with all coast lines; I picked Ireland since it shows the bug
>> nicely.
>>
>>
>> Regards,
>> Mark de Wever
>>
>> PS: It seems the old deprecated plmap code no longer shows a map (at
>> least on Windows). I didn't investigate further, I just installed the
>> shapelib library.
>>
>> PPS: There also seems to be another issue with a filled polygon map, but
>> I'm still investigating. If it really is an issue, I'll report it.
>>
>>
>

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2017-07-24 Thread Mark de Wever

Hi Phil,

I saw the release of 5.13 is being planned. I wondered whether it is 
possible to fix this issue before the release.


Regards,
Mark de Wever

On 18.11.16 18:30, p.d.rosenb...@gmail.com wrote:

Hi Mark
Thanks for the report. I'll have a look at your example over the weekend and 
see if I can fix the issue.

Phil

Sent from my Windows 10 phone

From: Mark de Wever
Sent: 18 November 2016 11:06
To: plplot-dev
Subject: [Plplot-devel] [Bug] Plmap omits lines at the left hand side of themap

Hi,

Recently I ran into an issue with the plplot 5.11.1 on Windows. The
plmap code seems to omit lines entirely when a part of the line is not
visible. This only occurs when the line is not visible on the left hand
side of the plot. When a part is not visible on the right hand side it
is properly shown.

At my Debian Stable system I use the system's 5.10.0 version. There the
issue doesn't occur. (I noticed the plmap code has been rewritten
between 5.10.0 and 5.11.0.) I also tested the bug on Debian Stable with
5.11.1 and a recent master [d71e48], both have the issue.

Attached a modified example 19 where the bug is shown. The first plot
shows the entire coast of Ireland. The second plot should only omit a
small part of the coast, but instead the entire coast has been removed.
Only the internal border of Ireland remains visible. This seems to
happen with all coast lines; I picked Ireland since it shows the bug nicely.


Regards,
Mark de Wever

PS: It seems the old deprecated plmap code no longer shows a map (at
least on Windows). I didn't investigate further, I just installed the
shapelib library.

PPS: There also seems to be another issue with a filled polygon map, but
I'm still investigating. If it really is an issue, I'll report it.





--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] [Bug] Plmap omits lines at the left hand side of the map

2016-11-18 Thread Mark de Wever

Hi,

Recently I ran into an issue with the plplot 5.11.1 on Windows. The 
plmap code seems to omit lines entirely when a part of the line is not 
visible. This only occurs when the line is not visible on the left hand 
side of the plot. When a part is not visible on the right hand side it 
is properly shown.


At my Debian Stable system I use the system's 5.10.0 version. There the 
issue doesn't occur. (I noticed the plmap code has been rewritten 
between 5.10.0 and 5.11.0.) I also tested the bug on Debian Stable with 
5.11.1 and a recent master [d71e48], both have the issue.


Attached a modified example 19 where the bug is shown. The first plot 
shows the entire coast of Ireland. The second plot should only omit a 
small part of the coast, but instead the entire coast has been removed. 
Only the internal border of Ireland remains visible. This seems to 
happen with all coast lines; I picked Ireland since it shows the bug nicely.



Regards,
Mark de Wever

PS: It seems the old deprecated plmap code no longer shows a map (at 
least on Windows). I didn't investigate further, I just installed the 
shapelib library.


PPS: There also seems to be another issue with a filled polygon map, but 
I'm still investigating. If it really is an issue, I'll report it.
//--
// $Id: x19.cc 12532 2013-09-26 15:18:37Z andrewross $
//--
//
//--
// Copyright (C) 2004  Andrew Ross
// Copyright (C) 2004  Alan W. Irwin
//
// This file is part of PLplot.
//
// PLplot is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// PLplot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with PLplot; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
//--
//
//--
// Implementation of PLplot example 19 in C++.
//--

#include "plc++demos.h"

#ifdef PL_USE_NAMESPACE
using namespace std;
#endif

class x19 {
public:
x19( int, char ** );

private:
// Class data
plstream *pls;
};

void
map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer /* data */ )
{
PLFLT radius;

radius = 90.0 - y;
*xt= radius * cos( x * M_PI / 180.0 );
*yt= radius * sin( x * M_PI / 180.0 );
}

//--
// mapform19
//
// Defines specific coordinate transformation for example 19.
// Not to be confused with mapform in src/plmap.c.
// x[], y[] are the coordinates to be plotted.
//--

void
mapform19( PLINT n, PLFLT *x, PLFLT *y )
{
int   i;
PLFLT xp, yp, radius;
for ( i = 0; i < n; i++ )
{
radius = 90.0 - y[i];
xp = radius * cos( x[i] * M_PI / 180.0 );
yp = radius * sin( x[i] * M_PI / 180.0 );
x[i]   = xp;
y[i]   = yp;
}
}

// "Normalize" longitude values so that they always fall between -180.0 and
// 180.0
PLFLT
normalize_longitude( PLFLT lon )
{
PLFLT times;
if ( lon >= -180.0 && lon <= 180.0 )
{
return ( lon );
}
else
{
times = floor( ( fabs( lon ) + 180.0 ) / 360.0 );
if ( lon < 0.0 )
{
return ( lon + 360.0 * times );
}
else
{
return ( lon - 360.0 * times );
}
}
}

// A custom axis labeling function for longitudes and latitudes.
void
geolocation_labeler( PLINT axis, PLFLT value, char *label, PLINT length, 
PLPointer /* data */ )
{
const char *direction_label = "";
PLFLT  label_val= 0.0;

if ( axis == PL_Y_AXIS )
{
label_val = value;
if ( label_val > 0.0 )
{
direction_label = " N";
}
else if ( label_val < 0.0 )
{
direction_label = " S";
}
else
{
direction_label = "Eq";
}
}
else if ( axis == PL_X_AXIS )
{
label_val = normalize_longitude( value );
if ( label_val > 0.0 )
{
direction_label = " E";
}
else if ( label_val < 0.0 )
{
direction_label = " W";
}
else
{