Пример #1
0
unsigned layprop::SDLine::nonius(const DBline& short_mark, const DBline& long_mark,
                                 const real step, LineList& llst) const
{
   // prepare the translation matrix for the edge point
   CTM tmtrx;
   tmtrx.Rotate(_angle);
   tmtrx.Translate(_ln.p1().x(), _ln.p1().y());
   unsigned numtics;
   for( numtics = 0 ; (numtics * step) < _length ; numtics++ )
   {
      // for each tick - get the deltas ...
      int4b deltaX = (int4b) rint(numtics * step * _cosinus);
      int4b deltaY = (int4b) rint(numtics * step * _sinus);
      // ... calculate the translation ...
      CTM pmtrx = tmtrx;
      pmtrx.Translate(deltaX, deltaY);
      // ... create a new tick and move it to its position
      if (numtics % 5)
         llst.push_back(DBline(short_mark * pmtrx));
      else
         llst.push_back(DBline(long_mark * pmtrx));
   }
   // don't forget the opposite edge point
   tmtrx.Translate(_ln.p2().x() - _ln.p1().x(), _ln.p2().y() - _ln.p1().y());
   llst.push_back(DBline(long_mark * tmtrx));
   return ++numtics;
}
Пример #2
0
bool read_from_script(LineList& ll, const char* script)
      {
      FILE* f = popen(script, "r");
      if (!f)
            return true;
      char buffer[LINMAX];
      int n = 0;
      int len;
      for (;;++n) {
            *buffer = 0;
            if ((len = xgets(buffer, LINMAX, f)) < 0)
                  break;
            //
            //    Backstep filtern
            //
            buffer[len] = 0;
            char* s = buffer;
            char* d = buffer;
            while (*s) {
                  if (*s == 0x8) {
                        if (d != buffer) {
                              --d;
                              len-=2;
                              }
                        }
                  else {
                        *d++ = *s;
                        }
                  ++s;
                  }
            ll.push_back(new Line(buffer, len));
            }
      pclose(f);
      return (len == -2);
      }
Пример #3
0
//-----------------------------------------------------------------------------
void CDrawContext::drawLines (const CPoint* points, const int32_t& numberOfLines)
{
	assert (numberOfLines < 0);
	LineList list (static_cast<uint32_t> (numberOfLines));
	for (int32_t i = 0; i < numberOfLines * 2; i += 2)
	{
		list.push_back (std::make_pair (points[i], points[i+1]));
	}
	drawLines (list);
}
Пример #4
0
// Read input file into memory buffer
int ReadInputFile(LineList &lines, const TCHAR *filename)
{
  FILE *f;
  char linebuf[MAXLINELEN];

  lines.clear();
 
  f = _wfopen(filename,TEXT("rb"));
  if (f==NULL) return 1;
  while (fgets(linebuf,MAXLINELEN,f)!=NULL) lines.push_back(linebuf);
  fclose(f);
  return 0;
}
Пример #5
0
void ProcessLine(LineList & theList, char * theData)
{
    char a[100], *b = 0;
    if ( b=strstr(theData, "BUILDMAJORVER") )
        sscanf(b, "%s %d", a, &MajorVersion);

    else if ( b=strstr(theData, "BUILDMINORVER") )
        sscanf(b, "%s %d", a, &MinorVersion);

    else if ( b=strstr(theData, "BUILDSUBVER") )
        sscanf(b, "%s %d", a, &SubVersion);

    else if ( b=strstr(theData, "BUILDNUMBER") )
    {
        sscanf(b, "%s %d", a, &BuildNumber);
        sprintf(theData, "#define BUILDNUMBER %d", ++BuildNumber);
    }
    else if ( b=strstr(theData, "WORDVER") )
    {
        sprintf(theData, "#define WORDVER %d, %d, %d, %d",
                MajorVersion,
                MinorVersion,
                SubVersion,
                BuildNumber);
    }
    else if ( b=strstr(theData, "DOTTEDVER") )
    {
        sprintf(theData, "#define DOTTEDVER \"%d.%d.%d.%d\"",
                MajorVersion,
                MinorVersion,
                SubVersion,
                BuildNumber);
    }
    else if ( b=strstr(theData, "COMMAVER") )
    {
        sprintf(theData, "#define COMMAVER \"%d, %d, %d, %d\"",
                MajorVersion,
                MinorVersion,
                SubVersion,
                BuildNumber);
    }
    else if ( b=strstr(theData, "BUILDSTRING") )
    {
        sprintf(theData, "#define BUILDSTRING \"Build %d\"", BuildNumber);
    }



    theList.push_back(theData);
}
Пример #6
0
void AddGRecordToBuffer(LineList &lines, md5generators_t *md5s)
{
  std::string str;

  str = "G";
  for (int i=0; i<16; i++) str += md5s->a.digestChars[i];
  str += "\r\n";
  str += "G";
  for (int i=0; i<16; i++) str += md5s->a.digestChars[i+16];
  str += "\r\n";
  lines.push_back(str);

  str = "G";
  for (int i=0; i<16; i++) str += md5s->b.digestChars[i];
  str += "\r\n";
  str += "G";
  for (int i=0; i<16; i++) str += md5s->b.digestChars[i+16];
  str += "\r\n";
  lines.push_back(str);

  str = "G";
  for (int i=0; i<16; i++) str += md5s->c.digestChars[i];
  str += "\r\n";
  str += "G";
  for (int i=0; i<16; i++) str += md5s->c.digestChars[i+16];
  str += "\r\n";
  lines.push_back(str);

  str = "G";
  for (int i=0; i<16; i++) str += md5s->d.digestChars[i];
  str += "\r\n";
  str += "G";
  for (int i=0; i<16; i++) str += md5s->d.digestChars[i+16];
  str += "\r\n";
  lines.push_back(str);
  
}
Пример #7
0
Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Point const &/*p*/) const
{
    LineList s;

    if ( NULL == _snapmanager->getNamedView() || ThisSnapperMightSnap() == false) {
        return s;
    }

    SPGuide const *guide_to_ignore = _snapmanager->getGuideToIgnore();

    for (GSList const *l = _snapmanager->getNamedView()->guides; l != NULL; l = l->next) {
        SPGuide const *g = SP_GUIDE(l->data);
        if (g != guide_to_ignore) {
            s.push_back(std::make_pair(g->normal_to_line, g->point_on_line));
        }
    }

    return s;
}
Пример #8
0
	void parseValue(const std::string string, int flags)
	{
		std::string name;
		std::string value;

		if(string == "{")
			return;
		if(string == "}")
			return;

		splitString(string, name, value, '=');
		if(name.empty() || string[0] == '<')
		{
			if(!string.empty())
				lines.push_back(string);

			return;
		}

		values[name].first = value;
		values[name].second = flags;
	}