Пример #1
0
bool SMFRenderStateGLSL::Init(const CSMFGroundDrawer* smfGroundDrawer) {
	const std::string names[GLSL_SHADER_COUNT - 1] = {
		"SMFShaderGLSL-Standard",
		"SMFShaderGLSL-Deferred",
	};
	const std::string defs =
		("#define SMF_TEXSQUARE_SIZE " + FloatToString(                  SMF_TEXSQUARE_SIZE) + "\n") +
		("#define SMF_INTENSITY_MULT " + FloatToString(CGlobalRendering::SMF_INTENSITY_MULT) + "\n") +
		("#define SMF_CLIP_PLANE_IDX " + IntToString(            IWater::ClipPlaneIndex()) + "\n") +
		("#define SMF_FRAGDATA_COUNT " + IntToString(GL::GeometryBuffer::ATTACHMENT_COUNT) + "\n");

	if (useLuaShaders) {
		for (unsigned int n = GLSL_SHADER_STANDARD; n <= GLSL_SHADER_DEFERRED; n++) {
			glslShaders[n] = shaderHandler->CreateProgramObject("[SMFGroundDrawer::Lua]", names[n] + "-Lua");
			// release ID created by GLSLProgramObject's ctor; should be 0
			glslShaders[n]->Release();
		}
	} else {
		for (unsigned int n = GLSL_SHADER_STANDARD; n <= GLSL_SHADER_DEFERRED; n++) {
			// load from VFS files
			glslShaders[n] = shaderHandler->CreateProgramObject("[SMFGroundDrawer::VFS]", names[n]);
			glslShaders[n]->AttachShaderObject(shaderHandler->CreateShaderObject("GLSL/SMFVertProg4.glsl", defs, GL_VERTEX_SHADER));
			glslShaders[n]->AttachShaderObject(shaderHandler->CreateShaderObject("GLSL/SMFFragProg4.glsl", defs, GL_FRAGMENT_SHADER));
		}
	}

	glslShaders[GLSL_SHADER_CURRENT] = glslShaders[GLSL_SHADER_STANDARD];
	return true;
}
Пример #2
0
std::string TextClass::XMFLOAT3ToString(XMFLOAT3 toConvert)
{
	return "( " +
		FloatToString(toConvert.x) + ", " +
		FloatToString(toConvert.y) + ", " +
		FloatToString(toConvert.z) + " )";
}
Пример #3
0
void DataClass::sendBluetooth(Measurement* measurement, int timeDec,
  int valueDec) {
  _signalBluetooth();
  Serial.println(DataLine(measurement->_name,
    FloatToString(measurement->_time, timeDec),
    FloatToString(measurement->_value, valueDec)));
}
Пример #4
0
void DataClass::sendBluetooth(Actuator* actuator, int timeDec,
  int valueDec) {
  _signalBluetooth();
  Serial.println(DataLine(actuator->_name,
    FloatToString(actuator->_time, timeDec),
    FloatToString(actuator->_value, valueDec)));
}
Пример #5
0
std::string ProfileReport::BuildProfileReport(){

	std::string myReport = "==="+ m_name +" ===";
	myReport += "\nTotal  : " + FloatToString((float)m_totalElapsedTime, "%.03f") +"ms";
	myReport += "\nAverage: " + FloatToString((float)m_averageElapsedTime, "%.03f") + "ms";
	myReport += "\nNum Calls: " + IntToString(m_numCalls) +"\n";
	//myReport += "\n% Frame Time: " + DoubleToString(m_percentFrameTime) + "\n";

	return myReport;
}
Пример #6
0
static std::string GetUnitDefBuildOptionToolTip(const UnitDef* ud, bool disabled) {
	std::string tooltip;
	tooltip += (disabled)?
		"\xff\xff\x22\x22" "DISABLED: " "\xff\xff\xff\xff":
		"Build: ";
	tooltip += (ud->humanName + " - " + ud->tooltip);
	tooltip += ("\nHealth "      + FloatToString(ud->health, "%.0f"));
	tooltip += ("\nMetal cost "  + FloatToString(ud->metal, "%.0f"));
	tooltip += ("\nEnergy cost " + FloatToString(ud->energy, "%.0f"));
	tooltip += ("\nBuild time "  + FloatToString(ud->buildTime, "%.0f"));

	return tooltip;
}
Пример #7
0
int printAllCutFlow(TString *cuts, int nbCuts){
	cout << "<cutFlow_"+name+">" << endl;
	printCutFlow(cuts,nbCuts,"all","1");
	for (int i = 110; i < 160 ; i=i+10){
		int lowRange = i - 5;
		int highRange = i + 5;
		TString lowPart = "dipho_mgg>"+FloatToString(lowRange);
		TString highPart = "dipho_mgg<"+FloatToString(highRange);
		TString theCond = lowPart + "&&" + highPart;
		TString theName = "masse"+FloatToString(i);
		printCutFlow(cuts,nbCuts,theName,theCond);
	}
	cout << "</cutFlow_"+name+">" << endl;
}
Пример #8
0
globle char *GetLogicalName(
  void *theEnv,
  int whichArgument,
  char *defaultLogicalName)
  {
   char *logicalName;
   DATA_OBJECT result;

   EnvRtnUnknown(theEnv,whichArgument,&result);

   if ((GetType(result) == SYMBOL) ||
       (GetType(result) == STRING) ||
       (GetType(result) == INSTANCE_NAME))
     {
      logicalName = ValueToString(result.value);
      if ((strcmp(logicalName,"t") == 0) || (strcmp(logicalName,"T") == 0))
        { logicalName = defaultLogicalName; }
     }
   else if (GetType(result) == FLOAT)
     {
      logicalName = ValueToString(EnvAddSymbol(theEnv,FloatToString(theEnv,DOToDouble(result))));
     }
   else if (GetType(result) == INTEGER)
     {
      logicalName = ValueToString(EnvAddSymbol(theEnv,LongIntegerToString(theEnv,DOToLong(result))));
     }
   else
     { logicalName = NULL; }

   return(logicalName);
  }
Пример #9
0
const char *GetLogicalName(
  UDFContext *context,
  const char *defaultLogicalName)
  {
   Environment *theEnv = context->environment;
   const char *logicalName;
   UDFValue theArg;

   if (! UDFNextArgument(context,ANY_TYPE_BITS,&theArg))
     { return NULL; }

   if (CVIsType(&theArg,LEXEME_BITS) ||
       CVIsType(&theArg,INSTANCE_NAME_BIT))
     {
      logicalName = theArg.lexemeValue->contents;
      if ((strcmp(logicalName,"t") == 0) || (strcmp(logicalName,"T") == 0))
        { logicalName = defaultLogicalName; }
     }
   else if (CVIsType(&theArg,FLOAT_BIT))
     {
      logicalName = CreateSymbol(theEnv,FloatToString(theEnv,theArg.floatValue->contents))->contents;
     }
   else if (CVIsType(&theArg,INTEGER_BIT))
     {
      logicalName = CreateSymbol(theEnv,LongIntegerToString(theEnv,theArg.integerValue->contents))->contents;
     }
   else
     { logicalName = NULL; }

   return(logicalName);
  }
Пример #10
0
LispObject* SqrtFloat(LispObject* int1, LispEnvironment& aEnvironment,int aPrecision)
{
    ANumber i1(*int1->Number(aPrecision)->iNumber);
    ANumber res(aPrecision);
    i1.ChangePrecision(aPrecision);
    Sqrt(res,i1);
    return FloatToString(res, aEnvironment);
}
Пример #11
0
void DataClass::sendSD(Measurement* measurement, int timeDec,
  int valueDec) {
  String filename = _filenameForSD(measurement->_name);
  char buf[filename.length()+1];
  filename.toCharArray(buf, filename.length()+1);

  File dataFile = SD.open(buf, FILE_WRITE);

  if (!measurement->_SDOpen) {
    measurement->_SDOpen = true;
    dataFile.println("---");
    dataFile.println("Time,Value");
  }

  dataFile.println(FloatToString(measurement->_time, timeDec)
    + "," + FloatToString(measurement->_value, valueDec));
  dataFile.close();
}
Пример #12
0
globle void PrintFloat(
  char *fileid,
  double number)
  {
   char *theString;

   theString = FloatToString(number);
   PrintRouter(fileid,theString);
  }
Пример #13
0
LispObject* ModFloat( LispObject* int1, LispObject* int2, LispEnvironment& aEnvironment,
                        int aPrecision)
{
    ANumber quotient(static_cast<int>(0));
    ANumber remainder(static_cast<int>(0));
    DivideInteger( quotient, remainder, int1->String()->c_str(), int2->String()->c_str(), aPrecision);
    return FloatToString(remainder, aEnvironment,10);

}
Пример #14
0
	Log& Log::operator<<( float i )
	{
		if(Instance)
		{
			string Message = FloatToString(i);
			Instance->WriteAll(Message.c_str());
		}

		return *this;
	}
Пример #15
0
globle void PrintFloat(
  void *theEnv,
  const char *fileid,
  double number)
  {
   const char *theString;

   theString = FloatToString(theEnv,number);
   EnvPrintRouter(theEnv,fileid,theString);
  }
Пример #16
0
void WriteFloat(
  Environment *theEnv,
  const char *fileid,
  double number)
  {
   const char *theString;

   theString = FloatToString(theEnv,number);
   WriteString(theEnv,fileid,theString);
  }
Пример #17
0
void  CArborEdit::SetValue( double val)
{
	if( EditStyleIs(EDIT_CURRENCY) || EditStyleIs(EDIT_FLOAT)) 
	{	  
		LPTSTR buff = new char[80];

		FloatToString( buff, val) ;
		SetWindowText(buff);
		delete buff;
	}
}
Пример #18
0
bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
                                         wxWindow *WXUNUSED(parentWindow) )
{
    // The item used for viewing the real number: should be a text item.
    wxWindow *m_propertyWindow = property->GetWindow();
    if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
        return false;

    wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
    textItem->SetValue(FloatToString(property->GetValue().RealValue()));
    return true;
}
Пример #19
0
void DataClass::sendSD(Sensor* sensor, int newTrial, int trialNum, 
int timeDec, int valueDec) 
{
  String filename = _filenameForSD(sensor->_name);
  char buf[filename.length()+1];
  filename.toCharArray(buf, filename.length()+1);

  File dataFile = SD.open(buf, FILE_WRITE);

  if (!sensor->_SDOpen) {
    sensor->_SDOpen = true;
  }
  if (newTrial) {
    dataFile.println("---");
    dataFile.println("Trial " + String(trialNum));
    dataFile.println("Time,Value");
  }

  dataFile.println(FloatToString(sensor->_timer.duration(), timeDec)
    + "," + FloatToString(sensor->readValue(), valueDec));
  dataFile.close();
}
Пример #20
0
bool SMFRenderStateGLSL::Init(const CSMFGroundDrawer* smfGroundDrawer) {
	if (!globalRendering->haveGLSL) {
		// not possible to do (GLSL) shader-based map rendering
		return false;
	}
	if (!configHandler->GetBool("AdvMapShading")) {
		// not allowed to do (GLSL) shader-based map rendering
		return false;
	}


	const std::string names[GLSL_SHADER_COUNT - 1] = {
		"SMFShaderGLSL-Standard",
		"SMFShaderGLSL-Deferred",
	};
	const std::string defs =
		("#define SMF_TEXSQUARE_SIZE " + FloatToString(                  SMF_TEXSQUARE_SIZE) + "\n") +
		("#define SMF_INTENSITY_MULT " + FloatToString(CGlobalRendering::SMF_INTENSITY_MULT) + "\n");


	if (useLuaShaders) {
		for (unsigned int n = GLSL_SHADER_STANDARD; n <= GLSL_SHADER_DEFERRED; n++) {
			glslShaders[n] = shaderHandler->CreateProgramObject("[SMFGroundDrawer::Lua]", names[n] + "-Lua", false);
			// release ID created by GLSLProgramObject's ctor; should be 0
			glslShaders[n]->Release();
		}
	} else {
		for (unsigned int n = GLSL_SHADER_STANDARD; n <= GLSL_SHADER_DEFERRED; n++) {
			// load from VFS files
			glslShaders[n] = shaderHandler->CreateProgramObject("[SMFGroundDrawer::VFS]", names[n], false);
			glslShaders[n]->AttachShaderObject(shaderHandler->CreateShaderObject("GLSL/SMFVertProg.glsl", "#version 120\n" + defs, GL_VERTEX_SHADER));
			glslShaders[n]->AttachShaderObject(shaderHandler->CreateShaderObject("GLSL/SMFFragProg.glsl", "#version 120\n" + defs, GL_FRAGMENT_SHADER));
		}
	}

	glslShaders[GLSL_SHADER_CURRENT] = glslShaders[GLSL_SHADER_STANDARD];
	return true;
}
Пример #21
0
LispObject* PowerFloat(LispObject* int1, LispObject* int2, LispEnvironment& aEnvironment,int aPrecision)
{
    if (int2->Number(aPrecision)->iNumber->iExp != 0)
        throw LispErrNotInteger();

    // Raising to the power of an integer can be done fastest by squaring
    // and bitshifting: x^(a+b) = x^a*x^b . Then, regarding each bit
    // in y (seen as a binary number) as added, the algorithm becomes:
    //
    ANumber x(*int1->Number(aPrecision)->iNumber);
    ANumber y(*int2->Number(aPrecision)->iNumber);
    bool neg = y.iNegative;
    y.iNegative=false;

    // result <- 1
    ANumber result("1",aPrecision);
    // base <- x
    ANumber base(aPrecision);
    base.CopyFrom(x);

    ANumber copy(aPrecision);

    // while (y!=0)
    while (!y.IsZero())
    {
        // if (y&1 != 0)
        if ( (y[0] & 1) != 0)
        {
            // result <- result*base
            copy.CopyFrom(result);
            Multiply(result,copy,base);
        }
        // base <- base*base
        copy.CopyFrom(base);
        Multiply(base,copy,copy);
        // y <- y>>1
        BaseShiftRight(y,1);
    }

    if (neg)
    {
        ANumber one("1",aPrecision);
        ANumber dummy(10);
        copy.CopyFrom(result);
        Divide(result,dummy,one,copy);
    }

    // result
    return FloatToString(result, aEnvironment);
}
Пример #22
0
LispObject* LispFactorial(LispObject* int1, LispEnvironment& aEnvironment,int aPrecision)
{
    int nr = InternalAsciiToInt(*int1->String());

    if (nr < 0)
        throw LispErrInvalidArg();

    ANumber fac("1",aPrecision);
    int i;
    for (i=2;i<=nr;i++)
    {
        BaseTimesInt(fac,i, WordBase);
    }
    return FloatToString(fac, aEnvironment);
}
Пример #23
0
//upkeep
void SliderWidget::Update(double deltaSeconds) {

	ProgressBarWidget::Update(deltaSeconds);
	
	AABB2 mySliderBounds = GetRenderBounds();
	Vector2 mySliderLength = mySliderBounds.CalcLengthOfSides();
	m_sliderButton->SetDimensions(Vector2(mySliderLength.x * 0.1f, mySliderLength.y * 1.25f));

	//set percent num
	WidgetStateProperties& currentStateProperties = GetCurrentStateProperties();
	float myPercent;
	currentStateProperties.GetProperty("percent", myPercent);
	std::string percentString = FloatToString(myPercent * 100, "%.0f") + "%";
	m_sliderButton->SetText(percentString);

	m_sliderButton->Update(deltaSeconds);

}
Пример #24
0
C_Game::C_Game(sf::RenderWindow* sc)
    : C_Mod(sc)
{
    sf::Clock loadTimer;

    glewInit();

    InitFog();
    InitTexture();

    _cam->setPosition(Vector3D(CHUNK_SIZE/2, CHUNK_SIZE/2, CHUNK_ZVALUE/2 +1.6f));
    _cam->setSpeed(0.0006);
    _screen->ShowMouseCursor(false);

    glEnable(GL_TEXTURE_2D);
    InitCubes();

    _boolJumping = false;
    _frameJumping = 0;

    InitGUI();
    SetItemInHotkeys(CUBE_DIRT, 0);
    SetItemInHotkeys(CUBE_SAND, 1);
    SetItemInHotkeys(CUBE_SAND+1, 2);
    SetItemInHotkeys(CUBE_SAND+2, 3);
    SetItemInHotkeys(CUBE_SAND+3, 4);
    SetItemInHotkeys(CUBE_SAND+4, 5);
    SetItemInHotkeys(CUBE_SAND+5, 6);
    SetItemInHotkeys(CUBE_SAND+6, 7);
    SetItemInHotkeys(CUBE_SAND+7, 8);

    _actuelCubeInHand = _itemInHotkeys[0];

    C_Log::GetSingleton()->AddMessage( std::string("Scene loaded in " + FloatToString(loadTimer.GetElapsedTime()) + "sec.") );

    /*C_LineEdit *widg = new C_LineEdit();
    widg->move(10, sc->GetHeight()-40);
    widg->resize(350, 30);
    AddWidget(widg);*/

    Launch();
}
Пример #25
0
std::string info_getValueAsString(const InfoItem* infoItem) {

	assert(infoItem != NULL);

	std::string stringValue = "";

	switch (infoItem->valueType) {
		case INFO_VALUE_TYPE_STRING: {
			stringValue = infoItem->valueTypeString;
		} break;
		case INFO_VALUE_TYPE_INTEGER: {
			stringValue = IntToString(infoItem->value.typeInteger);
		} break;
		case INFO_VALUE_TYPE_FLOAT: {
			stringValue = FloatToString(infoItem->value.typeFloat);
		} break;
		case INFO_VALUE_TYPE_BOOL: {
			stringValue = IntToString((int) infoItem->value.typeBool);
		} break;
	}

	return stringValue;
}
Пример #26
0
void QTPFSPathDrawer::DrawNode(
	const QTPFS::QTNode* node,
	const MoveDef* md,
	CVertexArray* va,
	bool fillQuad,
	bool showCost,
	bool batchDraw
) const {
	#define xminw (node->xmin() * SQUARE_SIZE)
	#define xmaxw (node->xmax() * SQUARE_SIZE)
	#define zminw (node->zmin() * SQUARE_SIZE)
	#define zmaxw (node->zmax() * SQUARE_SIZE)
	#define xmidw (node->xmid() * SQUARE_SIZE)
	#define zmidw (node->zmid() * SQUARE_SIZE)

	const float3 verts[5] = {
		float3(xminw, CGround::GetHeightReal(xminw, zminw, false) + 4.0f, zminw),
		float3(xmaxw, CGround::GetHeightReal(xmaxw, zminw, false) + 4.0f, zminw),
		float3(xmaxw, CGround::GetHeightReal(xmaxw, zmaxw, false) + 4.0f, zmaxw),
		float3(xminw, CGround::GetHeightReal(xminw, zmaxw, false) + 4.0f, zmaxw),
		float3(xmidw, CGround::GetHeightReal(xmidw, zmidw, false) + 4.0f, zmidw),
	};
	static const unsigned char colors[3][4] = {
		{1 * 255, 0 * 255, 0 * 255, 1 * 255}, // red --> blocked
		{0 * 255, 1 * 255, 0 * 255, 1 * 255}, // green --> passable
		{0 * 255, 0 * 255, 1 *  64, 1 *  64}, // light blue --> pushed
	};

	const unsigned char* color =
		(!showCost)?
			&colors[2][0]:
		(node->moveCostAvg == QTPFS_POSITIVE_INFINITY)?
			&colors[0][0]:
			&colors[1][0];

	if (!batchDraw) {
		if (!camera->InView(verts[4])) {
			return;
		}

		va->Initialize();
		va->EnlargeArrays(4, 0, VA_SIZE_C);

		if (!fillQuad) {
			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		}
	}

	va->AddVertexQC(verts[0], color);
	va->AddVertexQC(verts[1], color);
	va->AddVertexQC(verts[2], color);
	va->AddVertexQC(verts[3], color);

	if (!batchDraw) {
		va->DrawArrayC(GL_QUADS);

		if (!fillQuad) {
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		}
	}

	if (showCost && camera->GetPos().SqDistance(verts[4]) < (1000.0f * 1000.0f)) {
		font->SetTextColor(0.0f, 0.0f, 0.0f, 1.0f);
		font->glWorldPrint(verts[4], 5.0f, FloatToString(node->GetMoveCost(), "%8.2f"));
	}

	#undef xminw
	#undef xmaxw
	#undef zminw
	#undef zmaxw
	#undef xmidw
	#undef zmidw
}
Пример #27
0
void CGWorldOpenGL::WriteGWorldToDXF(CStdioFile *pFile, BOOL bShowClosureError, STATIONSHOW bShowStationNames, BOOL bBoxFixedPoints)
{
    // blocks
    CString stationBlockName = "STATION";
    CString fixedPointBlockName = "FIXEDPOINT";
    // layers
    CString stationLayerName1 = "S_STATION100";
    CString stationLayerName2 = "S_STATION500";
    CString shotLayerName = "S_SHOT";
    CString wallsLayerName = "S_PASSAGEWIDTH";
    CString ceilingLayerName = "S_PASSAGEHEIGHT";
    CString errorLayerName = "S_ERRORS";
    CString heightLayerName = "S_STATIONHEIGHT";
    //CString heightLayerName2 = "S_STATIONHEIGHT500";
    CString namesLayerName1 = "S_STATIONNAMES100";
    CString namesLayerName2 = "S_STATIONNAMES500";
    CString fixedPointLayerName = "S_FIXEDPOINT";
    CString wireFrameLayerName = "S_SURFACEDATA";
    CString crossSectionLayerName = "S_CROSSSECTION";
    CString surfaceShotLayerName = "S_SURFACESHOT";

    // show hourglass mouse pointer
    CWinApp *pApp = AfxGetApp();
    pApp -> BeginWaitCursor();

    // write DXF header
    ///////////////////
    pFile-> WriteString("0\nSECTION\n2\nHEADER\n");	// (note: a header section must exist (even if empty) to support LAYER tables)

    // read value off one item to set drawing limits (otherwise the cave may end-up in one corner of the autocad screen)
    if(m_ConstraintArray.GetSize())	// test just in case the user tries to export an empty file
    {
        const CGWorldOpenGLConstraint & fixedPoint=m_ConstraintArray.GetAt(0);
        pFile-> WriteString("9\n$LIMMIN\n10\n"+FloatToString(fixedPoint.position[0])+ "\n20\n"+FloatToString(fixedPoint.position[1])+
                            "\n9\n$LIMMAX\n10\n"+FloatToString(fixedPoint.position[0])+"\n20\n"+FloatToString(fixedPoint.position[1])+"\n");
    }

    pFile-> WriteString("0\nENDSEC\n");

    // write tables
    ///////////////
    pFile-> WriteString("0\nSECTION\n2\nTABLES\n");
    // write layers
    const int countLayers = 14; //15;
    CString layerNames[countLayers] = {"0", stationLayerName1, stationLayerName2, shotLayerName, wallsLayerName, ceilingLayerName,
                                       errorLayerName, heightLayerName, /*heightLayerName2,*/ namesLayerName1, namesLayerName2,
                                       fixedPointLayerName, wireFrameLayerName, crossSectionLayerName, surfaceShotLayerName
                                      };
    int layerColor[countLayers] = {7, 1, 1, 3, 5, 5, 1, 6, /*6,*/ 4, 4, 2, 8, 5, 9};

    pFile-> WriteString("0\nTABLE\n2\nLAYER\n70\n"+IntToString(countLayers)+"\n");	// change last item (after 70) to max number of layers

    for (int i=0; i<countLayers; ++i)		// write each layer
        pFile-> WriteString("0\nLAYER\n2\n"+layerNames[i]+"\n70\n0\n62\n"+IntToString(layerColor[i])+"\n6\nCONTINUOUS\n");

    pFile-> WriteString("0\nENDTAB\n");
    pFile-> WriteString("0\nENDSEC\n");

    // define blocks (to be included later in the drawing)
    ////////////////
    pFile-> WriteString("0\nSECTION\n2\nBLOCKS\n");

    // define station block
    pFile-> WriteString("0\nBLOCK\n8\n"+ stationLayerName1 + "\n2\n" + stationBlockName + "\n70\n0\n10\n0\n20\n0\n30\n0\n");
    // small triangle
    pFile-> WriteString("0\nSOLID\n8\n" + stationLayerName1 + "\n10\n0\n20\n0.15\n30\n0\n11\n-0.1299\n21\n-0.075\n31\n0\n12\n0.1299\n22\n-0.075\n32\n0\n13\n0.1299\n23\n-0.075\n33\n0\n");
    // large triangle
    pFile-> WriteString("0\nPOLYLINE\n8\n" + stationLayerName2 + "\n66\n1\n10\n0.0\n20\n0.0\n30\n0.0\n70\n1\n");
    pFile-> WriteString("0\nVERTEX\n8\n" + stationLayerName2 + "\n10\n0\n20\n0.5\n30\n0\n");
    pFile-> WriteString("0\nVERTEX\n8\n" + stationLayerName2 + "\n10\n-0.433\n20\n-0.25\n30\n0\n");
    pFile-> WriteString("0\nVERTEX\n8\n" + stationLayerName2 + "\n10\n0.433\n20\n-0.25\n30\n0\n");
    pFile-> WriteString("0\nSEQEND\n8\n" + stationLayerName2 + "\n");

    pFile-> WriteString("0\nENDBLK\n8\n" + stationLayerName1+"\n");

    // define fixedPoint block
    pFile-> WriteString("0\nBLOCK\n8\n"+ fixedPointLayerName + "\n2\n" + fixedPointBlockName + "\n70\n0\n10\n0\n20\n0\n30\n0\n");
    pFile-> WriteString("0\nSOLID\n8\n" + fixedPointLayerName + "\n10\n0.5\n20\n0.5\n30\n0\n11\n-0.5\n21\n0.5\n31\n0\n12\n0.5\n22\n-0.5\n32\n0\n13\n-0.5\n23\n-0.5\n33\n0\n");
    pFile-> WriteString("0\nENDBLK\n8\n" + fixedPointLayerName+"\n");

    pFile-> WriteString("0\nENDSEC\n");

    // write DXF entities
    /////////////////////
    pFile-> WriteString("0\nSECTION\n2\nENTITIES\n");

    // write lines
    int iCount=m_LineArray.GetSize();
    for (i=0; i<iCount; i++)
    {
        const CGWorldOpenGLLine& Line=m_LineArray.GetAt(i);

        BOOL bShowThisLine=TRUE;
        CString layer = "0";	// lines of undefined types go to layer 0

        switch (Line.lineType)
        {   // diferent types of lines are output to different layers
        case LT_SHOT:
            layer = shotLayerName;
            break;
        case LT_SURFACESHOT:
            layer = surfaceShotLayerName;
            break;
        case LT_CLOSUREERROR:
            layer = errorLayerName;
            bShowThisLine=bShowClosureError;
            break;
        case LT_PASSAGEWIDTH:
            layer = wallsLayerName;
            break;
        case LT_PASSAGEHEIGHT:
            layer = ceilingLayerName;
            break;
        case LT_SURFACE:
            layer = wireFrameLayerName;
            break;
        case LT_CROSSSECTION:
            layer = crossSectionLayerName;
            break;
//		case LT_WIREFRAME:	// those should not be seen since they only appear on screen when rotating
//		default:	// (there should be no other types)
//			break;
        }

        if (bShowThisLine)
            pFile-> WriteString("0\nLINE\n8\n" + layer +
                                "\n10\n" + FloatToString(Line.pt1[0]) + "\n20\n" + FloatToString(Line.pt1[1]) + "\n30\n" + FloatToString(Line.pt1[2]) +
                                "\n11\n" + FloatToString(Line.pt2[0]) + "\n21\n" + FloatToString(Line.pt2[1]) + "\n31\n" + FloatToString(Line.pt2[2]) + "\n");
    }

    // write stations and station's name and height
    int iLabelCount=m_LabelArray.GetSize();
    for (i=0; i<iLabelCount; i++)
    {
        const CGWorldOpenGLLabel & Label=m_LabelArray.GetAt(i);

        // write station name
        if (bShowStationNames==SHOW_ALL || (Label.bJunction && bShowStationNames==SHOW_INTERSECT))
        {
            // small text
            pFile-> WriteString("0\nTEXT\n8\n" + namesLayerName1 + "\n72\n2\n" +
                                "10\n" + FloatToString(Label.position[0]) + "\n20\n" + FloatToString(Label.position[1]) + "\n30\n" + FloatToString(Label.position[2]) +
                                "\n11\n" + FloatToString(Label.position[0] - (float)0.1299) + "\n21\n" + FloatToString(Label.position[1]) + "\n31\n" + FloatToString(Label.position[2]) +
                                "\n40\n0.4\n1\n" + Label.szName + "\n");
            // large text
            pFile-> WriteString("0\nTEXT\n8\n" + namesLayerName2 + "\n72\n2\n" +
                                "10\n" + FloatToString(Label.position[0]) + "\n20\n" + FloatToString(Label.position[1]) + "\n30\n" + FloatToString(Label.position[2]) +
                                "\n11\n" + FloatToString(Label.position[0] - (float)0.433) + "\n21\n" + FloatToString(Label.position[1]) + "\n31\n" + FloatToString(Label.position[2]) +
                                "\n40\n1.0\n1\n" + Label.szName + "\n");
        }
        // write station height
        // small text
        pFile-> WriteString("0\nTEXT\n8\n" + heightLayerName + "\n" + //"73\n3\n" +	// tag 73 is not recognized by AutoCAD v.10: we substract the font size from the y value
                            "10\n" + FloatToString(Label.position[0] + (float)0.1299) + "\n20\n" + FloatToString(Label.position[1]-(float)0.4) + "\n30\n" + FloatToString(Label.position[2]) +
                            "\n11\n" + FloatToString(Label.position[0] + (float)0.1299) + "\n21\n" + FloatToString(Label.position[1]-(float)0.4) + "\n31\n" + FloatToString(Label.position[2]) +
                            "\n40\n0.4\n1\n" + FloatToString(Label.position[2]) + "\n");
        /*		// large text
        		pFile-> WriteString("0\nTEXT\n8\n" + heightLayerName2 + "\n73\n3\n" +
        					"10\n" + FloatToString(Label.position[0]) + "\n20\n" + FloatToString(Label.position[1]) + "\n30\n" + FloatToString(Label.position[2]) +
        					"\n11\n" + FloatToString(Label.position[0] + (float)0.433) + "\n21\n" + FloatToString(Label.position[1]) + "\n31\n" + FloatToString(Label.position[2]) +
        					"\n40\n1.0\n1\n" + FloatToString(Label.position[2]) + "\n");
        */
        // draw station
        pFile-> WriteString("0\nINSERT\n2\n" + stationBlockName + "\n8\n" + stationLayerName1 +
                            "\n10\n" + FloatToString(Label.position[0])+ "\n20\n" + FloatToString(Label.position[1]) + "\n30\n" + FloatToString(Label.position[2]) + "\n");
    }

    // write fixed points and fixed points' text
    int iFixedPointCount=m_ConstraintArray.GetSize();
    for (i=0; i<iFixedPointCount; i++)
    {
        const CGWorldOpenGLConstraint & fixedPoint=m_ConstraintArray.GetAt(i);

        if (!fixedPoint.bSearchResultTag)	// only show fixed points: not search results '?' tags
        {
            // write text
            pFile-> WriteString("0\nTEXT\n8\n" + fixedPointLayerName +
                                "\n10\n" + FloatToString(fixedPoint.position[0] + (float)0.6) + "\n20\n" + FloatToString(fixedPoint.position[1]) + "\n30\n" + FloatToString(fixedPoint.position[2]) +
                                "\n40\n1.0\n1\n" + fixedPoint.node->GetName() + "\n");

            // draw fixed point
            pFile-> WriteString("0\nINSERT\n2\n" + fixedPointBlockName + "\n8\n" + fixedPointLayerName +
                                "\n10\n" + FloatToString(fixedPoint.position[0])+ "\n20\n" + FloatToString(fixedPoint.position[1]) + "\n30\n" + FloatToString(fixedPoint.position[2]) + "\n");

        }
    }

    // end of 'entities' section and end of file
    pFile-> WriteString("0\nENDSEC\n0\nEOF\n");

    // hide hourglass mouse pointer
    pApp -> EndWaitCursor();
}
Пример #28
0
globle const char *DataObjectToString(
  void *theEnv,
  DATA_OBJECT *theDO)
  {
   void *thePtr;
   const char *theString;
   char *newString;
   const char *prefix, *postfix;
   size_t length;
   struct externalAddressHashNode *theAddress;
   char buffer[30];
   
   switch (GetpType(theDO))
     {
      case MULTIFIELD:
         prefix = "(";
         theString = ValueToString(ImplodeMultifield(theEnv,theDO));
         postfix = ")";
         break;
         
      case STRING:
         prefix = "\"";
         theString = DOPToString(theDO);
         postfix = "\"";
         break;
         
      case INSTANCE_NAME:
         prefix = "[";
         theString = DOPToString(theDO);
         postfix = "]";
         break;
         
      case SYMBOL:
         return(DOPToString(theDO));
         
      case FLOAT:
         return(FloatToString(theEnv,DOPToDouble(theDO)));
         
      case INTEGER:
         return(LongIntegerToString(theEnv,DOPToLong(theDO)));
         
      case RVOID:
         return("");

#if OBJECT_SYSTEM
      case INSTANCE_ADDRESS:
         thePtr = DOPToPointer(theDO);

         if (thePtr == (void *) &InstanceData(theEnv)->DummyInstance)
           { return("<Dummy Instance>"); }
           
         if (((struct instance *) thePtr)->garbage)
           {
            prefix = "<Stale Instance-";
            theString = ValueToString(((struct instance *) thePtr)->name);
            postfix = ">";
           }
         else
           {
            prefix = "<Instance-";
            theString = ValueToString(GetFullInstanceName(theEnv,(INSTANCE_TYPE *) thePtr));
            postfix = ">";
           }
           
        break;
#endif
      
      case EXTERNAL_ADDRESS:
        theAddress = (struct externalAddressHashNode *) DOPToPointer(theDO);
        /* TBD Need specific routine for creating name string. */
        gensprintf(buffer,"<Pointer-%d-%p>",(int) theAddress->type,DOPToExternalAddress(theDO));
        thePtr = EnvAddSymbol(theEnv,buffer);
        return(ValueToString(thePtr));

#if DEFTEMPLATE_CONSTRUCT      
      case FACT_ADDRESS:
         if (DOPToPointer(theDO) == (void *) &FactData(theEnv)->DummyFact)
           { return("<Dummy Fact>"); }
         
         thePtr = DOPToPointer(theDO);
         gensprintf(buffer,"<Fact-%lld>",((struct fact *) thePtr)->factIndex);
         thePtr = EnvAddSymbol(theEnv,buffer);
         return(ValueToString(thePtr));
#endif
                        
      default:
         return("UNK");
     }
     
   length = strlen(prefix) + strlen(theString) + strlen(postfix) + 1;
   newString = (char *) genalloc(theEnv,length);
   newString[0] = '\0';
   genstrcat(newString,prefix);
   genstrcat(newString,theString);
   genstrcat(newString,postfix);
   thePtr = EnvAddSymbol(theEnv,newString);
   genfree(theEnv,newString,length);
   return(ValueToString(thePtr));
  }
Пример #29
0
int stack_push_float(object store, string name, float entry)
{
    return stack_push_string(store,name,FloatToString(entry));
}
Пример #30
0
int array_set_float(object store, string name, int i, float entry)
{
    return array_set_string(store,name,i,FloatToString(entry));
}