osgrid.org
https://forums.osgrid.org/

Parcel Map
https://forums.osgrid.org/viewtopic.php?f=5&t=6241
Page 1 of 1

Author:  Logan Bamaisin [ Tue Oct 02, 2018 6:13 pm ]
Post subject:  Parcel Map

Evening everyone, it's nice to grab the region texture's uuid and display it with osGetMapTexture() however is there a call to show parcel borders or parcels up for 'sale'? I was thinking about using osSetDynamicTextureData and define the parcel borders but not sure if there's another way as the end goal is to display a map of available land to those that visit my regions.

-Logan

Author:  dj phil [ Wed Oct 03, 2018 10:45 am ]
Post subject:  Re: Parcel Map

To my knowledge, there is currently no OSSL function for tracing the borders of the different parcels of a region.
You could ask on the Mantis of Opensim to have a new function for tracing the parcels.

Otherwise, you could get a result of a "web" image (like GetTexture Service or Map Image Servive) of the region and draw yourself the boundaries on the image of the region with the osDrawLine or osDrawRectangle functions or with php and a external library like Imagick ...

Or you could make a screen of your area with the parcels drawn with different prims and once the sceen done, you erase the prims of tracing.

Author:  Total Sorbet [ Sun Jan 06, 2019 3:30 pm ]
Post subject:  Re: Parcel Map

This will display parcel boundaries over region map on face 0 of prim:

//Sim Parcel Mapping
//Total Sorbet Jan 2019

integer resolution=256;
integer timer_chunksize=26;

integer parcels;
string cmd;
integer iterx;
integer itery;

addline(integer x1,integer y1,integer x2,integer y2)
{
y1=parcels-y1-1;y2=parcels-y2-1;++x1;++x2;
float ps=(integer)resolution/(parcels-1);
cmd+="MoveTo "+(string)(x1*ps)+","+(string)(y1*ps)+";LineTo "+(string)(x2*ps)+","+(string)(y2*ps)+";";
}

default
{
on_rez(integer p){llResetScript();}
state_entry()
{
llSetTexture(osGetMapTexture(),0);
vector s=osGetRegionSize();
parcels=(integer)(s.x/4.0);
iterx=0;itery=0;
llSetTimerEvent(0.5);
}
timer()
{
llSetTimerEvent(0);
llResetTime();
while(itery<parcels && iterx<parcels && llGetTime()<timer_chunksize)
{
string t=llList2String(llGetParcelDetails(<iterx<<2,itery<<2,0>,[PARCEL_DETAILS_ID]),0);
if(iterx<parcels-1)if(t!=llList2String(llGetParcelDetails(<(iterx+1)<<2,itery<<2,0>,[PARCEL_DETAILS_ID]),0))addline(iterx,itery-1,iterx,itery);
if(itery<parcels-1)if(t!=llList2String(llGetParcelDetails(<iterx<<2,(itery+1)<<2,0>,[PARCEL_DETAILS_ID]),0))addline(iterx-1,itery,iterx,itery);
if(++iterx==parcels){++itery;iterx=0;}
}
if(itery<parcels)llSetTimerEvent(0.5);
else
{
osSetDynamicTextureDataBlendFace("","vector","PenSize 1;PenColor FFFFFF00;"+cmd,"width:"+(string)resolution+",height:"+(string)resolution+",alpha:0",TRUE,2,0,255,0);
cmd="";
llSay(0,"done");
}
}
}

Author:  dj phil [ Sun Jan 06, 2019 8:42 pm ]
Post subject:  Re: Parcel Map

Hi Total Sorbet, Nice job! :)

Your script drove me crazy for a moment ...

Indeed, it worked very well on Sandbox Plaza for example but did not work at all on my simulators.
It appears that on server hosted Linux everything is fine with your script but not on Windows.
it seems that under Linux, the penultimate parameter of the function dynamic texture data blend face, the alpha, has no effect ... but under Windows it works.
By modifying this parameter with the value 255 your script works well under Windows and Linux.

Relief, I'm not crazy!

For Wndows users, remplace:
{L_CODE}:
osSetDynamicTextureDataBlendFace("","vector","PenSize 1;PenColor FFFFFF00;"+cmd,"width:"+(string)resolution+",height:"+(string)resolution+",alpha:0",TRUE,2,0,0,0);
by:
{L_CODE}:
osSetDynamicTextureDataBlendFace("","vector","PenSize 1;PenColor FFFFFF00;"+cmd,"width:"+(string)resolution+",height:"+(string)resolution+",alpha:0",TRUE,2,0,255,0);
Thank you for your great work! :)

PS: Bug repported on mantis #8442

Author:  Total Sorbet [ Mon Jan 07, 2019 7:22 am ]
Post subject:  Re: Parcel Map

Hey DJ Phil,

Nice find! It may come as no surprise this was written/tested on linux system.

Thanks for sparing people from further crazyness! Gotta love opensim :mrgreen:

I have edited script here to reflect proper value.

Author:  Jeeper Shim [ Mon Jan 07, 2019 8:43 am ]
Post subject:  Re: Parcel Map

The script works great. Thanks for that.

Author:  Total Sorbet [ Tue Jan 08, 2019 3:13 pm ]
Post subject:  Re: Parcel Map

I was scratching my head thinking this could be done better...
Previous version would add a draw command for every 4m of parcel line leading to a large command list for osSetDynamicTextureDataBlendFace(). I was concerned this could become unmanageable for large vars with many parcels. In this version where lines join (be it horizontally or vertically) they are described as one long line leading to a much reduced command list length.

Untested on windows or on large vars with many parcels.

{L_CODE}:
//Sim Parcel Mapping v2
//Total Sorbet Jan 2019


integer resolution=256;        //use power 2 ie..128, 256, 512, 1024 - on higher resolutions it might be useful to change PenSize to something greater than 1
integer timer_chunksize=26;


string cmd;
integer ii1;
integer ii2;
integer hor=-1;
integer ver=-1;
integer pwidth;
integer ppixel;


addline(integer x1,integer y1,integer x2,integer y2)
    {
    cmd+="MoveTo "+(string)(x1*ppixel)+","+(string)((pwidth-y1)*ppixel)+";LineTo "+(string)(x2*ppixel)+","+(string)((pwidth-y2)*ppixel)+";";
    }
   
   
default
    {
    on_rez(integer p){llResetScript();}
    state_entry()
        {
        llSetTexture(osGetMapTexture(),0);
        vector s=osGetRegionSize();
        pwidth=(integer)(s.x/4.0);
        ppixel=resolution/pwidth;
        llSetTimerEvent(0.5);
        }
    timer()
        {
        llSetTimerEvent(0);   
        llResetTime();
        while(ii2<pwidth-1 && llGetTime()<timer_chunksize)
            {
            string h1=llList2String(llGetParcelDetails(<ii1<<2,ii2<<2,0>,[PARCEL_DETAILS_ID]),0); 
            string h2=llList2String(llGetParcelDetails(<ii1<<2,(ii2+1)<<2,0>,[PARCEL_DETAILS_ID]),0);
            string v1=llList2String(llGetParcelDetails(<ii2<<2,ii1<<2,0>,[PARCEL_DETAILS_ID]),0);
            string v2=llList2String(llGetParcelDetails(<(ii2+1)<<2,ii1<<2,0>,[PARCEL_DETAILS_ID]),0);
            if(h1!=h2 && !~hor)hor=ii1;else if (h1==h2 && ~hor){addline(hor,ii2+1,ii1,ii2+1);hor=-1;}
            if(v1!=v2 && !~ver)ver=ii1;else if(v1==v2 && ~ver){addline(ii2+1,ver,ii2+1,ii1);ver=-1;}
            ++ii1;
            if(ii1==pwidth)
                {
                if(~hor)addline(hor,ii2+1,ii1,ii2+1);
                if(~ver)addline(ii2+1,ver,ii2+1,ii1);
                hor=-1;ver=-1;ii1=0;++ii2;
                }
            }
        if(ii2<pwidth-1)llSetTimerEvent(0.5);
        else
            {
            osSetDynamicTextureDataBlendFace("","vector","PenSize 1;PenColor FFFFFF00;"+cmd,"width:"+(string)resolution+",height:"+(string)resolution+",alpha:0",TRUE,2,0,255,0);
            cmd="";
            llSay(0,"done");
            }
        }
    }

Author:  dj phil [ Wed Jan 16, 2019 3:49 pm ]
Post subject:  Re: Parcel Map

Bug #8442 fixed on Commit d8e5b7 & b2810c :)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/