[Qgis-developer] (no subject)

Tim Sutton tim at linfiniti.com
Fri Apr 21 03:50:26 EDT 2006


Hi

The GrassQt code is not part of QGIS and I dont think there is anyone on
this list who is able to help you with your problem :-( I suggest using the
email form on the grassqt website to further your query:

http://navicon.dk/web/contact.php?pageid=45

I'm sorry we cant be of more assistance.

Regards

Tim

On 21 Apr 2006 04:04:57 -0000, Nitin quick <quickuser at rediffmail.com> wrote:
>
>
> Hello Tim
> I am sorry i didn't provided with enough infomation. Actually the code i
> am talking about is not completely mine. Its a GRASSQt code which itried to
> modify sop that it can use current vector library of grass.GrassQt was
> originally written for grass5.0+ support.
> Code i am putting here is the one which reads the map lines( lines only)
> and pass it to Qpainter. I am not clear which part of code to attch. I am
> also attaching 2 screen shots of soils vector map in spearfish60 dataset.
> One having red background and white foreground(snapshiot2.png) is the one
> mine and other screen shot is of actual output(snapshot4) generated using
> grass.
>
>
> /this code is responsible for displaying of reading of line and sending to
> painter*/
>
> void GRASSVectorLayer::linePlot(QPainter* p) {
>   int nlines = Vect_get_num_lines (&P_map);
>   int j=0;
>      printf(" \n:+: no of lines in map %d VectorLayer.cpp-72-",nlines);
>   struct line_cats* _cats = Vect_new_cats_struct();
> /* declared to make it compatible with the grass 6+, newer vector library
> */
>   p->setPen(Qt::white);// originally was _penColor
>
>   if(0!=Vect_set_constraint_region (&P_map, _painter->grassRegion().north,
>                      _painter->grassRegion().south,
>                      _painter->grassRegion().east,
>                      _painter->grassRegion().west,
>                     _painter->grassRegion().top,
>                     _painter->grassRegion().bottom     ))
>      printf("\n:+: Vect_set_constraint_region returns error ");
>
>   if(Vect_rewind(&P_map)==-1)
>      printf("\n:+: Error Vect_rewind ");
>
>   while (1) {
>     int ret; j++;// j counts no of lines added by painter
>     if (0 > (ret = Vect_read_next_line (&P_map, _points,_cats))) {/* _cats
> added as argument */
>       if (ret == -1)
>      G_warning ("Read error at VectorLayer.cpp-91- breaking\n");
>       break;
>     }
>     int np = _points->n_points;//GRASSVectorLayer::linePlot read
> VectorLayer.cpp
>       cout << "\t" << np << " points";
>     double* x  = _points->x;
>     double* y =  _points->y;
>      //printf(" :+:");
>     /*if( np==1)
>      { plot_line(x[0],y[0],x[0],y[0],p); j++;}
>     else*/
>
>       for (int i=1; i < np; i++)
>      {
>            plot_line (x[i-1], y[i-1], x[i], y[i], p);
>            x++;    y++;
>         }
>   }
>      printf("\n :+:Drawing donne %d lines printed -108-Vectorlayer.cpp\t",j);
> //this can't be done here
> }
>
> #define X(e) (_painter->D.D_u_to_d_col(e))
> #define Y(n) (_painter->D.D_u_to_d_row(n))
>
>
> int GRASSVectorLayer::plot_line(double east1,double north1,
>                     double east2,double north2, QPainter* p)
> {
>     double x1,x2,y1,y2;
>
>     y1 = Y(north1);
>     y2 = Y(north2);
>
>     if (_painter->grassRegion().proj == PROJECTION_LL)
>     {
>      if (east1 > east2)
>          while ((east1-east2) > 180)
>           east2 += 360;
>      else if (east2 > east1)
>          while ((east2-east1) > 180)
>           east1 += 360;
>      while (east1 > _painter->grassRegion().east)
>      {
>          east1 -= 360.0;
>          east2 -= 360.0;
>      }
>      while (east1 < _painter->grassRegion().west)
>      {
>          east1 += 360.0;
>          east2 += 360.0;
>      }
>      x1 = X(east1);
>      x2 = X(east2);
>
>      //p->moveTo(x1, y1);
>      //p->lineTo(x2, y2);
>      p->drawLine(x1,y1,x2,y1);
>      if (east2 > _painter->grassRegion().east || east2 <
> _painter->grassRegion().west)
>      {
>          while (east2 > _painter->grassRegion().east)
>          {
>           east1 -= 360.0;
>           east2 -= 360.0;
>          }
>          while (east2 < _painter->grassRegion().west)
>          {
>           east1 += 360.0;
>           east2 += 360.0;
>          }
>          x1 = X(east1);
>          x2 = X(east2);
>        //  p->moveTo(x1, y1);
>        // p->lineTo(x2, y2);
>
>          p->drawLine(x1,y1,x2,y2);
>      }
>     }
>     else
>     {
>      x1 = X(east1);
>      x2 = X(east2);
>      //p->moveTo(x1, y1);
>      //p->lineTo(x2, y2);
>
>      p->drawLine(x1,y1,x2,y2);
>     }
>
>     return 0;
> }
> thanks
> cya
> nitin
>
> On Thu, 20 Apr 2006 Tim Sutton wrote :
> >Hi Nitin
> >
> >Can you provide a better explanation? Some background information on
> >what it is you are trying to achieve? Some source code for us to look
> >at? Some screenshots?
> >
> >Thanks
> >
> >Tim
> >
> >On 20 Apr 2006 12:42:59 -0000, Nitin quick <quickuser at rediffmail.com>
> wrote:
> > >
> > >
> > >
> > >  hello Group
> > >  I am a newbee in GIS development.
> > >  I read the GRASS Sample data "spearfish60" using grass 6.0.1 vector
> library line by line, and displayed it using Qpainter and QCanvas but output
> is no the exact map. Some distorted lines has come in. Also lines printed
> are not of same no as total no of lines in Map.
> > >
> > >  any help is welcome,
> > >
> > >  cya
> > >  nitin
> > >
> > >
> > >
> > > _______________________________________________
> > > Qgis-developer mailing list
> > > Qgis-developer at lists.qgis.org
> > > http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
> > >
> > >
> > >
> >
> >
> >
> >--
> >Tim Sutton
> >
> >Visit http://qgis.org for a great Open Source GIS
> >Skype: timlinux
> >MSN: tim_bdworld at msn.com
> >Yahoo: tim_bdworld at yahoo.com
> >Jabber: timlinux
> >Irc: timlinux on #qgis at freenode.net
>
>
> <http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3>
>
>


--
Tim Sutton

Visit http://qgis.org for a great Open Source GIS
Skype: timlinux
MSN: tim_bdworld at msn.com
Yahoo: tim_bdworld at yahoo.com
Jabber: timlinux
Irc: timlinux on #qgis at freenode.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20060421/641e9b62/attachment.html


More information about the Qgis-developer mailing list