void MapParamDlg::RebuildTable() { MutexWrap params_access(m_params_map_mutex); int key = 1, list_line = 0, index; char buf[50]; CParam *param; CString str; m_table_list.DeleteAllItems(); while (list_line < m_MapParamDefault.GetCount()) { if (m_MapParamDefault.Lookup(key, param)) { itoa(key, buf, 10); index = m_table_list.InsertItem(list_line, buf); m_table_list.SetItemData(index, key); SetupLine(index, param); list_line++; } key++; } m_table_list.SetColumnWidth(2, WIDTH_DATA_COL + ((m_table_list.GetCountPerPage() < m_table_list.GetItemCount()) ? 0 : 16)); }
void SetupUnit::SetupVertex() { switch (m_PrimType) { case GX_DRAW_QUADS: SetupQuad(); break; case GX_DRAW_QUADS_2: WARN_LOG(VIDEO, "Non-standard primitive drawing command GL_DRAW_QUADS_2"); SetupQuad(); break; case GX_DRAW_TRIANGLES: SetupTriangle(); break; case GX_DRAW_TRIANGLE_STRIP: SetupTriStrip(); break; case GX_DRAW_TRIANGLE_FAN: SetupTriFan(); break; case GX_DRAW_LINES: SetupLine(); break; case GX_DRAW_LINE_STRIP: SetupLineStrip(); break; case GX_DRAW_POINTS: SetupPoint(); break; } }
void MapParamDlg::ChooseChannel(int item) { MutexWrap params_access(m_params_map_mutex); int param_num = m_table_list.GetItemData(item); CParam* param = NULL; if (!m_MapParamDefault.Lookup(param_num, param)) CRUSH("Параметр отсутствует"); CHECK(param != NULL); NewCorrespondenceDlg dlg(param, false); if (dlg.DoModal() == IDCANCEL) return; if (param->bParamActive) { m_MapParam[param_num] = param; param->Init(); } else { param->StartTimeOut(); m_MapParam.RemoveKey(param_num); } SetupLine(item, param); }
static int DrawLines(Engine *engine, long n, const GpReal *px, const GpReal *py, int closed, int smooth) { XEngine *xeng = (XEngine *)engine; p_win *w = xeng->w; long i, imax; int npts; if (!w) return 1; if (n<=0 || SetupLine(xeng, &gistA.l, 0)) return 0; closed = (closed && n>1 && (px[0]!=px[n-1] || py[0]!=py[n-1])); for (i=0 ; i<n ; i=imax) { imax = i+2047; npts = (imax<=n)? 2047 : (int)(n-i); p_d_pnts(w, px+i, py+i, npts); if (closed && imax>=n) p_d_pnts(w, px, py, -1); p_lines(w); } xeng->e.marked = 1; return 0; }
static int DrawDisjoint(Engine *engine, long n, const GpReal *px, const GpReal *py, const GpReal *qx, const GpReal *qy) { XEngine *xeng = (XEngine *)engine; p_win *w = xeng->w; long i, imax; int nseg; if (!w || !xeng->mapped) return 1; if (SetupLine(xeng, &gistA.l, 1)) return 0; p_d_pnts(w, px, py, 0); for (i=0 ; i<n ;) { imax = i+1024; nseg = (imax<=n)? 1024 : (int)(n-i); while (nseg--) { p_d_pnts(w, px+i, py+i, -1); p_d_pnts(w, qx+i, qy+i, -1); i++; } p_segments(w); } xeng->e.marked = 1; return 0; }
static int DrawLines(Engine *engine, long n, const GpReal *px, const GpReal *py, int closed, int smooth) { PSEngine *psEngine= (PSEngine *)engine; GpXYMap *map= &engine->map; long maxPoints= 4050, nPoints; long np= n + (closed?1:0); int firstPass= 1, markEnd= 0; GpPoint firstPoint, *points; int size; if (CheckClip(psEngine)) return 1; if (n<1) return 0; if (SetupLine(psEngine, &gistA.l)) return 1; if (psEngine->curClip) size= 0; else size= (int)(psEngine->curWidth*0.5*DEFAULT_PS_WIDTH); if (np>90) { long nLines= (np-1)/9 + 1; /* 9 points is 72 characters */ if (psEngine->nchars && PutLine(psEngine)) return 1; sprintf(line, "%%%%BeginData: %ld ASCII Lines", nLines+1); if (Append(psEngine, line) || PutLine(psEngine)) return 1; markEnd= 1; } sprintf(line, smooth? "%ld LS" : "%ld L", np); if (Append(psEngine, line) || PutLine(psEngine)) return 1; while ((nPoints= GpIntPoints(map, maxPoints, n, px, py, &points))) { if (closed) { if (firstPass) { firstPoint= points[0]; firstPass= 0; } if (n==nPoints) { n++; points[nPoints++]= firstPoint; } } if (PutPoints(psEngine, points, nPoints, size)) return 1; if (n==nPoints) break; n-= nPoints; px+= nPoints; py+= nPoints; } if (markEnd) { if (Append(psEngine, "%%EndData") || PutLine(psEngine)) return 1; } return 0; }
static int DrawFill(Engine *engine, long n, const GpReal *px, const GpReal *py) { PSEngine *psEngine= (PSEngine *)engine; GpXYMap *map= &engine->map; long maxPoints= 4050, nPoints; int markEnd= 0; GpPoint *points; int value= 0; /* For now, only FillSolid style supported */ if (n<1) return 0; if (CheckClip(psEngine) || SetupColor(psEngine, gistA.f.color)) return 1; if (n>90) { long nLines= (n-1)/9 + 1; /* 9 points is 72 characters */ if (psEngine->nchars && PutLine(psEngine)) return 1; sprintf(line, "%%%%BeginData: %ld ASCII Lines", nLines+1); if (Append(psEngine, line) || PutLine(psEngine)) return 1; markEnd= 1; } if (gistA.e.type==L_NONE) sprintf(line, "%ld F", n); else sprintf(line, "%ld E", n); if (Append(psEngine, line) || PutLine(psEngine)) return 1; while ((nPoints= GpIntPoints(map, maxPoints, n, px, py, &points))) { if (PutPoints(psEngine, points, nPoints, 0)) return 1; if (n==nPoints) break; n-= nPoints; px+= nPoints; py+= nPoints; value= 1; /* Polygons with >4050 sides won't be filled correctly */ } if (gistA.e.type!=L_NONE) { /* setup for edge (usually different color than fill), then draw it */ if (SetupLine(psEngine, &gistA.e)) return 1; if (Append(psEngine, "0 E") || PutLine(psEngine)) return 1; } if (markEnd) { if (Append(psEngine, "%%EndData") || PutLine(psEngine)) return 1; } return value; }
static int DrawFill(Engine *engine, long n, const GpReal *px, const GpReal *py) { XEngine *xeng = (XEngine *)engine; p_win *w = xeng->w; long i, imax; int npts, has_edge; if (!w || !xeng->mapped) return 1; has_edge = !SetupLine(xeng, &gistA.e, 0); /* but shouldn't set color */ p_color(w, gistA.f.color); /* This gives incorrect results if more than one pass through the loop, * but there is no way to give the correct result, so may as well... */ for (i=0 ; i<n ; i=imax) { imax = i+2048; npts = (imax<=n)? 2048 : (int)(n-i); p_d_pnts(w, px+i, py+i, npts); /* Can Nonconvex or Convex be detected? */ p_fill(w, 0); } xeng->e.marked = 1; if (has_edge) { p_color(w, gistA.e.color); for (i=0 ; i<n ; i=imax) { imax = i+2047; npts = (imax<=n)? 2047 : (int)(n-i); p_d_pnts(w, px+i, py+i, npts); if (imax>=n) p_d_pnts(w, px, py, -1); p_lines(w); } } return 0; }