示例#1
0
void SvgDeviceContext::DrawEllipticArc(int x, int y, int width, int height, double start, double end)
{
    /*
    Draws an arc of an ellipse. The current pen is used for drawing the arc
    and the current brush is used for drawing the pie. This function is
    currently only available for X window and PostScript device contexts.

    x and y specify the x and y coordinates of the upper-left corner of the
    rectangle that contains the ellipse.

    width and height specify the width and height of the rectangle that
    contains the ellipse.

    start and end specify the start and end of the arc relative to the
    three-o'clock position from the center of the rectangle. Angles are
    specified in degrees (360 is a complete circle). Positive values mean
    counter-clockwise motion. If start is equal to end, a complete ellipse
    will be drawn. */

    //known bug: SVG draws with the current pen along the radii, but this does not happen in wxMSW

    std::string s ;
    //radius
    double rx = width / 2 ;
    double ry = height / 2 ;
    // center
    double xc = x + rx ;
    double yc = y + ry ;

    double xs, ys, xe, ye ;
    xs = xc + rx * cos (DegToRad(start)) ;
    xe = xc + rx * cos (DegToRad(end)) ;
    ys = yc - ry * sin (DegToRad(start)) ;
    ye = yc - ry * sin (DegToRad(end)) ;

    ///now same as circle arc...

    double theta1 = atan2(ys-yc, xs-xc);
    double theta2 = atan2(ye-yc, xe-xc);

    int fArc  ;                  // flag for large or small arc 0 means less than 180 degrees
    if ( (theta2 - theta1) > 0 ) fArc = 1; else fArc = 0 ;

    int fSweep ;
    if ( fabs(theta2 - theta1) > M_PI) fSweep = 1; else fSweep = 0 ;

    // this version closes the arc
    //s.Printf ( "<path d=\"M%d %d A%d %d 0.0 %d %d  %d %d L %d %d z ",
    //    int(xs), int(ys), int(rx), int(ry),
    //    fArc, fSweep, int(xe), int(ye), int(xc), int(yc)  );

    WriteLine( StringFormat("<path d=\"M%d %d A%d %d 0.0 %d %d  %d %d \" />",
        int(xs), int(ys), abs(int(rx)), abs(int(ry)),
        fArc, fSweep, int(xe), int(ye) ) );
}
示例#2
0
void main()
{
  long i;
  struct A c;
  struct B qq;

  c.z.r = 987654321;

  a.x = 1;
  a.y = 2;

  c.x = 9;
  c.y = 0;

  b[0].x = 3;
  b[0].y = 4;

  b[a.x].x = 5;
  b[a.x].y = 6;

  b[b[a.x-1].x-1].x = 7;
  b[b[a.y-2].x-1].y = 8;

  WriteLong(a.x);
  WriteLong(a.y);
  WriteLine();

  i = 0;
  while (i < 3) {
    WriteLong(b[i].x);
    WriteLong(b[i].y);
    WriteLine();
    i = i + 1;
  }

  WriteLong(c.x);
  WriteLong(c.y);
  WriteLine();

  WriteLong(c.z.r);
  WriteLine();
}
示例#3
0
void VDJSONWriter::WriteMemberName(const wchar_t *name, size_t len) {
	if (!mbFirstItem)
		Write(L",", 1);
	mbFirstItem = false;

	WriteLine();
	WriteIndent();

	WriteRawString(name, len);
	Write(L": ", 2);
}
示例#4
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszKey - 
//			r - 
//			g - 
//			b - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValueColor(const char *pszKey, unsigned char r, unsigned char g, unsigned char b)
{
	if (pszKey != NULL)
	{
		char szBuf[MAX_KEYVALUE_LEN];
		Q_snprintf(szBuf, sizeof( szBuf ), "\"%s\" \"%d %d %d\"", pszKey, (int)r, (int)g, (int)b);
		return(WriteLine(szBuf));
	}

	return(ChunkFile_Ok);
}
示例#5
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszKey - 
//			fValue - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValueFloat(const char *pszKey, float fValue)
{
	if (pszKey != NULL)
	{
		char szBuf[MAX_KEYVALUE_LEN];
		Q_snprintf(szBuf, sizeof( szBuf ), "\"%s\" \"%g\"", pszKey, (double)fValue);
		return(WriteLine(szBuf));
	}

	return(ChunkFile_Ok);
}
示例#6
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszKey - 
//			nValue - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValueInt(const char *pszKey, int nValue)
{
	if (pszKey != NULL)
	{
		char szBuf[MAX_KEYVALUE_LEN];
		Q_snprintf(szBuf, sizeof( szBuf ), "\"%s\" \"%d\"", pszKey, nValue);
		return(WriteLine(szBuf));
	}

	return(ChunkFile_Ok);
}
示例#7
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszLine - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValue(const char *pszKey, const char *pszValue)
{
	if ((pszKey != NULL) && (pszValue != NULL))
	{
		char szTemp[MAX_KEYVALUE_LEN];
		Q_snprintf(szTemp, sizeof( szTemp ), "\"%s\" \"%s\"", pszKey, pszValue);
		return(WriteLine(szTemp));
	}

	return(ChunkFile_Ok);
}
示例#8
0
 void Close()
 {
     CMutexGuard guard(m_FileMutex);
     if (m_hFile != INVALID_HANDLE_VALUE)
     {
         char sEnd[] = "[End]";
         WriteLine(sEnd, sizeof(sEnd) - 1);
         ::CloseHandle(m_hFile);
         m_hFile = INVALID_HANDLE_VALUE;
     }
 }
示例#9
0
void WriteString(int nLineCode, CString& strValue)
{
	if (nLineCode > NUM_ITEMS)
		return;
	if (nLineCode > 0)
		strLine.Format("%s = %s",tszItemName[nLineCode],
								 (LPCTSTR)strValue);
	else
		strLine.Format("%s",(LPCTSTR)strValue);
	WriteLine();
}
示例#10
0
    void WriteThreshold(const DSC_Threshold& threshold)
    {
        static const int thVer = 0;
        WriteInt(thVer);

        WriteInt(int(threshold.minThreshold));
        WriteInt(int(threshold.maxThreshold));
        WriteDouble(threshold.minVal, SC_RealFormat(ncf_Scientific, 10));
        WriteDouble(threshold.maxVal, SC_RealFormat(ncf_Scientific, 10));
        WriteLine();
    }
示例#11
0
    void WriteStringArray(const SC_StringArray& strings)
    {

        WriteInt(strings.Size());
        WriteInt(strings.GetStringLen());
        WriteLine();
        for (int i = 0; i < strings.Size(); i++ )
            {
                WriteText(strings[i]);
            }
    }
示例#12
0
void ConsoleBuffer::Printf(int severity, const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);

	char buf[4096];
	vsnprintf(buf, 4096, fmt, args);
	va_end(args);

	WriteLine(severity, &buf[0]);
}
示例#13
0
void 
ScriptEngine::parseVar(char * c, char ** args)
{	// $VARIABLE = value
	NamedVar  var;
	if (_numVars == MAX_VARIABLES) {
		WriteLine(PSTR("Maximum variables in use.\r\n"));
		return;
	}
	if ( var = GetVariableByName((++c)), !strcmp(var.name,"!FOUND")) {
		// new variable
		var = GetNextAvailVariable();
		StringCopy(var.name,c);
		var.val.val16 = atol(args[1]);
		if (!AddVariable(var))
			WriteLine(PSTR("Problem writing variable to EEPROM."));
	}	else {	// reassigning an instantiated variable
		var.val.val16 = atoi(args[1]);
		eeprom_write_block((const void*)&var,(void*)&Variables[var.slot], sizeof(NamedVar));	
	}
}
示例#14
0
void IRCSession::HandleKick(IRCMessage& recvData)
{
	vector<string> res(1);
	split(recvData.Minden, " ", res);

	if(res.size() < 5)
	{
		res.clear();
		return;
	}

	if(res[4] == m_NickTarolo)
	{
		if(FSelect(REJOIN) == bekapcsol && FSelectChannel(REJOIN, recvData.Channel) == bekapcsol)
		{
			map<string, string>::iterator itr = m_ChannelLista.begin();
			for(; itr != m_ChannelLista.end(); itr++)
			{
				string join = itr->first;

				if(itr->second != "")
					join += " " + itr->second;

				WriteLine("JOIN %s", join.c_str());
			}
		}
	}
	else
	{
		if(sConsole.GetConsoleLog())
		{
			if(res.size() < 6)
			{
				res.clear();
				return;
			}

			string oka;
			int resAdat = res.size();


			for(int i = 5; i < resAdat; i++)
				oka += " " + res[i];

			printf("%s kickelte a kovetkezo felhasznalot: %s oka: %s\n", recvData.GetNick(), res[4].c_str(), oka.substr(2).c_str());
		}
	}

#ifdef _DEBUG_MOD
	Log.Warning("Funkcio", "A %s funkcio nem uzemel!", REJOIN);
#endif

	res.clear();
}
示例#15
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszKey - 
//			fVector - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValueVector4(const char *pszKey, const Vector4D &vec)
{
	if (pszKey != NULL)
	{
		char szBuf[MAX_KEYVALUE_LEN];
		Q_snprintf(szBuf, sizeof( szBuf ), "\"%s\" \"[%g %g %g %g]\"", pszKey, (double)vec.x, (double)vec.y, (double)vec.z, (double)vec.w);
		return( WriteLine( szBuf ) );
	}

	return( ChunkFile_Ok );
}
示例#16
0
int
main (
  int argc,
  char*argv[]
  )
/*++

Routine Description:

  GC_TODO: Add function description

Arguments:

  argc  - GC_TODO: add argument description
  ]     - GC_TODO: add argument description

Returns:

  GC_TODO: add return values

--*/
{
  char  LineBuffer[256];
  FILE  *fpin;
  FILE  *fpout;

  if (argc < 3) {
    Usage ();
    return -1;
  }

  fpin = fopen (argv[1], "rb");
  if (!fpin) {
    printf ("Can't open input file!\r\n");
    return -1;
  }

  fpout = fopen (argv[2], "wb");
  if (!fpout) {
    fclose (fpin);
    printf ("Can't create output file!\r\n");
    return -1;
  }

  while (ReadLine (LineBuffer, fpin)) {
    ApplyPattern (LineBuffer, argv, argc);
    WriteLine (LineBuffer, fpout);
  }

  fclose (fpin);
  fclose (fpout);

  return 0;
}
示例#17
0
void main()
{
  a = 16807;
  m = 127;
  m = m * 256 + 255;
  m = m * 256 + 255;
  m = m * 256 + 255;
  q = m / a;
  r = m % a;
  Factorial(7);
  WriteLong(res);
  WriteLine();
  WriteLine();
  FibRec(11);
  WriteLong(res);
  WriteLine();
  WriteLine();
  Hanoi(3);
  WriteLine();
}
示例#18
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszKey - 
//			fVector - 
// Output : 
//-----------------------------------------------------------------------------
ChunkFileResult_t CChunkFile::WriteKeyValuePoint(const char *pszKey, const Vector &Point)
{
	if (pszKey != NULL)
	{
		char szBuf[MAX_KEYVALUE_LEN];
		Q_snprintf(szBuf, sizeof( szBuf ), "\"%s\" \"(%g %g %g)\"", pszKey, (double)Point[0], (double)Point[1], (double)Point[2]);
		return(WriteLine(szBuf));
	}

	return(ChunkFile_Ok);
}
示例#19
0
int main (int argc, char* argv[])
{
    AffineTransform2D* M = AffineTransform2D_BuildTransformFromTwoPairs
	(1.0, 2.0, 4.0, 2.0, 3.0, 2.0, 6.0, 4.0, 320, 240);
    
    WriteLine ("M = %s", SimpleMatrix_ToString ((SimpleMatrix*)M));
    
    SimpleMatrix* X = SimpleMatrix_new (3, 1);
    X->values[0][ 0] = 4;
    X->values[1][ 0] = 5;
    X->values[2][ 0] = 1;

    SimpleMatrix* m = SimpleMatrix_Mul((SimpleMatrix*)M, X);
    WriteLine ("M * X = %s", SimpleMatrix_ToString(m));

    AffineTransform2D_delete(M);
    SimpleMatrix_delete(X);
    SimpleMatrix_delete(m);
    return 0;
}
示例#20
0
void WriteAnnoSpec(const PSC_AnnoSpec& annoSpec)
{
    const int specVer = 0;
    WriteInt(specVer);
    WriteLine();

    SetRealConvFormat(SC_RealFormat(ncf_Decimal, 3));
    WriteDouble(annoSpec.ulLocation.pX);
    WriteDouble(annoSpec.ulLocation.pY);
    WriteLine();

    WriteText(annoSpec.legendTitle);

    WriteBool(annoSpec.frameLegend);
    WriteInt (annoSpec.frameThick);
    WriteBool(annoSpec.opaqueBackground);
    WriteInt (annoSpec.legendPen);

    WriteFont(annoSpec.legendFont);
}
示例#21
0
void WriteStippleSpec(const PSC_StippleSpec& stippleSpec)
{
    static const int stippVer = 0;
    WriteInt(stippVer);

    WriteInt(stippleSpec.stippleType);
    WriteInt(stippleSpec.stipplePen);
    WriteInt(stippleSpec.stippleSize);
    WriteInt(stippleSpec.stippleLineThickness);
    WriteLine();
}
示例#22
0
void WriteEdgeSpec(const PSC_EdgeSpec& edgeSpec)
{
    static const int edgeVer = 0;
    WriteInt(edgeVer);

    WriteBool(edgeSpec.plotEdges);
    WriteInt(edgeSpec.edgePen       );
    WriteInt(edgeSpec.edgeThk       );
    WriteDouble(edgeSpec.edgePolyOffset, SC_RealFormat(ncf_Scientific, 2));
    WriteLine();
}
示例#23
0
/* should use write once */
int OutputHttpHeaders(int conn, struct ReqInfo* reqinfo)
{
	char buffer[100];
	sprintf(buffer, "HTTP/1.0 %d OK\r\nServer: WebServ v0.1\r\nContent-Type: text/html\r\n\r\n", reqinfo->status);
//	sprintf(buffer, "HTTP/1.0 %d OK\r\n", reqinfo->status);
	WriteLine(conn, buffer, strlen(buffer));
	//WriteLine(conn, "Server: WebServ v0.1\r\n", 24);
	//WriteLine(conn, "Content-Type: text/html\r\n", 25);
	//WriteLine(conn, "\r\n", 2);
	return 0;
}
示例#24
0
void main() {

    long i;
    long j;
    long temp;
    long array[n];

    i = 0;
    while (i < n) {
        array[i] = (n - i - 1);
        i = i + 1;
    }

    i = 0;
    while (i < n) {
        WriteLong(array[i]);
        i = i + 1;
    }
    WriteLine();

    i = 0;
    while (i < n) {
        j = 0;
        while (j < i) {
            if (array[j] > array[i]) {
                temp = array[i]; 
                array[i] = array[j];
                array[j] = temp;
            }
            j = j + 1;
        }
        i = i + 1;
    }

    i = 0;
    while (i < n) {
        WriteLong(array[i]);
        i = i + 1;
    }
    WriteLine();
}
示例#25
0
/**
 * Kill
 *
 * Disconnects from the IRC server and destroys the connection object.
 *
 * @param Error error message
 */
void CIRCConnection::Kill(const char *Error) {
	if (GetOwner() != NULL) {
		GetOwner()->SetIRCConnection(NULL);
	}

	m_FloodControl->Clear();
	m_FloodControl->Disable();
	
	WriteLine("QUIT :%s", Error);

	CConnection::Kill(Error);
}
示例#26
0
void Write3DSeriesSpec(const PSC_3DSeriesSpec& seriesSpec)
{
    WriteSeriesSpec(seriesSpec);
    WriteEdgeSpec(seriesSpec);
    WriteTubeExtrusionSpec(seriesSpec);

//    WriteInt(int(seriesSpec.plotLineType));  // removed v1
    WriteBool(seriesSpec.plotLineAsTube);  // added v1
    WriteBool(seriesSpec.plotSymEdges);
    WriteBool(seriesSpec.plotTubeEdges);
    WriteLine();
}
示例#27
0
void WriteLineSpec(const PSC_LineSpec& lineSpec)
{
    static const int writeVer = 1; // added mitreLine
//    static const int writeVer = 0;
    WriteInt(writeVer);

    WriteInt(lineSpec.linePen     );
    WriteInt(lineSpec.lineType    );
    WriteInt(lineSpec.lineThickness );
    WriteBool(lineSpec.mitreLines);
    WriteLine();
}
示例#28
0
void PPO_GridColorBlockFill::WriteToFile()
{
    const int objMajVer = 2;    // added report format
//    const int objMajVer = 1;    // added 3D
//    const int objMajVer = 0;
    const int objMinVer = 0;

    WriteObjectHeader(objMajVer, objMinVer);
    PPO_Base::WriteToFile();
    WriteColorBase(*this);

    Write3DGridData(*this);

    WriteDouble(areaReduction);
    WriteLine();

    WriteEdgeSpec(edgeSpec);
    WriteRealFormat(reportFormat);
    WriteLine();

}
示例#29
0
void DPO_Normalize::WriteToFile()
{
    const int stVer = 0;
    WriteInt(stVer);
    SetRealConvFormat(SC_RealFormat(ncf_Scientific, 8));

    WriteRealMSSpec(bpRef.normPowerMS);
    WriteBool(bpRef.isMaster);
    WriteLine();

    WriteInt(int(bpRef.normalizeDC.normalizeOp));
    WriteBool(bpRef.normalizeDC.autoLimit);
    WriteDouble(bpRef.normalizeDC.inputMinimum);
    WriteDouble(bpRef.normalizeDC.inputMaximum);
    WriteDouble(bpRef.normalizeDC.outputMinimum);
    WriteDouble(bpRef.normalizeDC.outputMaximum);
    WriteDouble(bpRef.normalizeDC.normPower);
    WriteLine();

    exposedNormPower.WriteExposed();
}
示例#30
0
void DPO_CreateSpecialCDF::WriteToFile()
{
    // ver 0
    const int objMajVer = 0;
    const int objMinVer = 0;

    WriteObjectHeader(objMajVer, objMinVer);
    WriteFuncObjRef(xyInputObjRef);
    WriteInt(int(distributionType));
    WriteBool(normalizeInputProbabilities);
    WriteLine();
}