当前位置: 首页>>代码示例>>C++>>正文


C++ wxMemoryDC::DrawLines方法代码示例

本文整理汇总了C++中wxMemoryDC::DrawLines方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMemoryDC::DrawLines方法的具体用法?C++ wxMemoryDC::DrawLines怎么用?C++ wxMemoryDC::DrawLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxMemoryDC的用法示例。


在下文中一共展示了wxMemoryDC::DrawLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RenderViewOnDC


//.........这里部分代码省略.........
        y = lat_min;

//        printf("%d %d\n", lon_min, lon_max);

        //  Make positive definite longitude for easier integer math
        lon_min += 720;
        lon_max += 720;

        double ref_lon = VPoint.clon;

//      Loop around the lat/lon spec to get and draw the vector segments
        for(y = lat_min ; y < lat_max ; y++)
        {
                for(x = lon_min ; x < lon_max ; x++)
                {
//      Get the arrays of lat/lon vector segments
//      Sanity Check
                      int xt = x;
                      int yt = y;
//      Check the cache first
                        int ix = xt % 360; //xt + 180;                               // bias to positive
                        int iy = yt + 90;

                        if(  (ix > 359) || (ix < 0) || (iy > 179) || (iy < 0) )
                                continue;


                        if(-1 == nseg[ix][iy])                          // no data yet
                        {
                                                                                                     // so fill cache
                                platray = NULL;
                                plonray = NULL;
                                psegray = NULL;
                                int nsegments = wvsrtv (*pwvs_file_name,
                                        y, ix, &platray, &plonray, &psegray);
                                plat_ray[ix][iy] = platray;
                                plon_ray[ix][iy] = plonray;
                                pseg_ray[ix][iy] = psegray;
                                nseg[ix][iy] = nsegments;
//                                printf("load at %d %d \n", ix, iy);

                        }
 //                       else
 //                             printf("     from cache at %d %d \n", ix, iy);

                        if(nseg[ix][iy])
                        {
                                float *plat_seg = plat_ray[ix][iy];
                                float *plon_seg = plon_ray[ix][iy];
                                int *pseg_cnt = pseg_ray[ix][iy];
                                for(int iseg = 0 ; iseg < nseg[ix][iy] ; iseg++)
                                {
                                        int seg_cnt = *pseg_cnt++;
                                        if(seg_cnt > cur_seg_cnt_max)
                                        {
                                                cur_seg_cnt_max = seg_cnt;
                                                ptp = (wxPoint *)realloc(ptp, seg_cnt * sizeof(wxPoint));
                                        }
                                        wxPoint *pr = ptp;
                                        wxPoint p;



                                        for(int ip = 0 ; ip < seg_cnt ; ip++)
                                        {
                                                float plat = *plat_seg++;
                                                float plon = *plon_seg++;

                                                if(fabs(plon - ref_lon) > 180.)
                                                {
                                                      if(plon > ref_lon)
                                                            plon -= 360.;
                                                      else
                                                            plon += 360.;
                                                }


                                                double easting, northing;
                                                toSM(plat, plon + 360., VPoint.clat, ref_lon + 360., &easting, &northing);
                                                double epix = easting  * VPoint.view_scale_ppm;
                                                double npix = northing * VPoint.view_scale_ppm;

                                                double dx = epix * cos(VPoint.skew) + npix * sin(VPoint.skew);
                                                double dy = npix * cos(VPoint.skew) - epix * sin(VPoint.skew);
                                                p.x = (int)round((VPoint.pix_width  / 2) + dx);
                                                p.y = (int)round((VPoint.pix_height / 2) - dy);

                                                *pr = p;
                                                pr++;
                                        }
                                        dc.DrawLines(seg_cnt, ptp);
                                }
                        }
                }       // for x
        }       //for y
        platray = NULL;
        plonray = NULL;
        psegray = NULL;
        wvsrtv (_T("clean"), y, x, &platray, &plonray, &psegray);
}
开发者ID:dongmingdmdm,项目名称:OpenCPN,代码行数:101,代码来源:wvschart.cpp


注:本文中的wxMemoryDC::DrawLines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。