示例#1
0
// read map path data -------------------------------------------------------
void __fastcall TPlot::ReadMapPath(AnsiString file)
{
    FILE *fp;
    int n=0;
    char buff[1024];
    double pos[3];
    
    if (!(fp=fopen(file.c_str(),"r"))) return;
    
    while (fgets(buff,sizeof(buff),fp)&&n<MAXMAPPATH) {
        
        if (sscanf(buff,"%lf %lf %lf",pos,pos+1,pos+2)!=3) continue;
        pos[0]*=D2R;
        pos[1]*=D2R;
        pos2ecef(pos,MapPath+n*3);
        n++;
    }
    fclose(fp);
    
    NMapPath=n;
    
    BtnShowPoint->Down=true;
    
    UpdatePlot();
}
示例#2
0
LRESULT CMainDlg::OnGibbs(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	gibbs = IsDlgButtonChecked(IDC_GIBBS) == BST_CHECKED;
	SetDlgItemText(IDC_GIBBS, gibbs ? "Gibbs ON" : "Gibbs OFF");
	UpdatePlot();
	return 0;
}
示例#3
0
// disconnect from external sources -----------------------------------------
void __fastcall TPlot::Disconnect(void)
{
    AnsiString s;
    char *cmd;
    int i;
    
    trace(3,"Disconnect\n");
    
    if (!ConnectState) return;
    
    ConnectState=0;
    
    for (i=0;i<2;i++) {
        if (StrCmdEna[i][1]) {
            cmd=StrCmds[i][1].c_str();
            strwrite(Stream+i,(unsigned char *)cmd,strlen(cmd));
        }
        strclose(Stream+i);
    }
    if (strstr(Caption.c_str(),"CONNECT")) {
        Caption=s.sprintf("DISCONNECT%s",Caption.c_str()+7);
    }
    UpdateTime();
    UpdatePlot();
}
示例#4
0
// read elevation mask data -------------------------------------------------
void __fastcall TPlot::ReadElMaskData(AnsiString file)
{
    AnsiString s;
    FILE *fp;
    double az0=0.0,el0=0.0,az1,el1;
    int i,j;
    char buff[256];
    
    trace(3,"ReadElMaskData\n");
    
    for (i=0;i<=360;i++) ElMaskData[i]=0.0;
    
    if (!(fp=fopen(file.c_str(),"r"))) {
        ShowMsg(s.sprintf("no el mask data: %s...",file.c_str()));
        ShowLegend(NULL);
        return;
    }
    while (fgets(buff,sizeof(buff),fp)) {
        
        if (buff[0]=='%'||sscanf(buff,"%lf %lf",&az1,&el1)<2) continue;
        
        if (az0<az1&&az1<=360.0&&0.0<=el1&&el1<=90.0) {
            
            for (j=(int)az0;j<=(int)az1;j++) ElMaskData[j]=el0*D2R;
        }
        az0=az1; el0=el1;
    }
    fclose(fp);
    UpdatePlot();
}
示例#5
0
// read map image data ------------------------------------------------------
void __fastcall TPlot::ReadMapData(AnsiString file)
{
    TJPEGImage *image=new TJPEGImage;
    AnsiString s;
    
    trace(3,"ReadMapData\n");
    
    try {
        image->LoadFromFile(file);
    }
    catch (Exception &exception) {
        ShowMsg(s.sprintf("map file read error: %s",file));
        ShowLegend(NULL);
        return;
    }
    MapImage->Assign(image);
    MapImageFile=file;
    MapSize[0]=MapImage->Width;
    MapSize[1]=MapImage->Height;
    delete image;
    
    ReadMapTag(file);
    
    BtnShowMap->Down=true;
    
    MapAreaDialog->UpdateField();
    UpdatePlot();
}
示例#6
0
// connect to external sources ----------------------------------------------
void __fastcall TPlot::Connect(void)
{
    AnsiString s;
    char *cmd,*path,buff[MAXSTRPATH],*name[2]={"",""},*p;
    int i,mode=STR_MODE_R;
    
    trace(3,"Connect\n");
    
    if (ConnectState) return;
    
    for (i=0;i<2;i++) {
        if      (RtStream[i]==STR_NONE    ) continue;
        else if (RtStream[i]==STR_SERIAL  ) path=StrPaths[i][0].c_str();
        else if (RtStream[i]==STR_FILE    ) path=StrPaths[i][2].c_str();
        else if (RtStream[i]<=STR_NTRIPCLI) path=StrPaths[i][1].c_str();
        else continue;
        
        if (RtStream[i]==STR_FILE||!SolData[i].cyclic||SolData[i].nmax!=RtBuffSize+1) {
            Clear();
            initsolbuf(SolData+i,1,RtBuffSize+1);
        }
        if (RtStream[i]==STR_SERIAL) mode|=STR_MODE_W;
        
        strcpy(buff,path);
        if ((p=strstr(buff,"::"))) *p='\0';
        if ((p=strstr(buff,"/:"))) *p='\0';
        if ((p=strstr(buff,"@"))) name[i]=p+1; else name[i]=buff;
        
        if (!stropen(Stream+i,RtStream[i],mode,path)) {
            ShowMsg(s.sprintf("connect error: %s",name));
            ShowLegend(NULL);
            trace(1,"stream open error: ch=%d type=%d path=%s\n",i+1,RtStream[i],path);
            continue;
        }
        strsettimeout(Stream+i,RtTimeOutTime,RtReConnTime);
        
        if (StrCmdEna[i][0]) {
            cmd=StrCmds[i][0].c_str();
            strwrite(Stream+i,(unsigned char *)cmd,strlen(cmd));
        }
        ConnectState=1;
    }
    if (!ConnectState) return;
    
    if (Title!="") Caption=Title;
    else Caption=s.sprintf("CONNECT %s %s",name[0],name[1]);
    
    BtnConnect->Down=true;
    BtnSol1   ->Down=*name[0];
    BtnSol2   ->Down=*name[1];
    BtnSol12  ->Down=false;
    BtnShowTrack->Down=true;
    BtnFixHoriz->Down=true;
    UpdateEnable();
    UpdateTime();
    UpdatePlot();
}
示例#7
0
// read observation data ----------------------------------------------------
void __fastcall TPlot::ReadObs(TStrings *files)
{
    obs_t obs={0};
    nav_t nav={0};
    sta_t sta={0};
    AnsiString s;
    char file[1024];
    int i,nobs;
    
    trace(3,"ReadObs\n");
    
    if (files->Count<=0) return;
    
    ReadWaitStart();
    ShowLegend(NULL);
    
    if ((nobs=ReadObsRnx(files,&obs,&nav,&sta))<=0) {
        ReadWaitEnd();
        return;
    }
    ClearObs();
    Obs=obs;
    Nav=nav;
    Sta=sta;
    SimObs=0;
    UpdateObs(nobs);
    UpdateMp();
    
    if (ObsFiles!=files) {
        ObsFiles->Assign(files);
    }
    NavFiles->Clear();
    
    strcpy(file,U2A(files->Strings[0]).c_str());
    
    Caption=s.sprintf("%s%s",file,files->Count>1?"...":"");
    
    BtnSol1->Down=true;
    time2gpst(Obs.data[0].time,&Week);
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    
    if (PlotType<PLOT_OBS||PLOT_DOP<PlotType) {
        UpdateType(PLOT_OBS);
    }
    else {
        UpdatePlotType();
    }
    FitTime();
    
    ReadWaitEnd();
    UpdateObsType();
    UpdateTime();
    UpdatePlot();
}
示例#8
0
// clear data ---------------------------------------------------------------
void __fastcall TPlot::Clear(void)
{
    AnsiString s;
    double ep[]={2010,1,1,0,0,0};
    int i;
    
    trace(3,"Clear\n");
    
    Week=NObs=0;
    
    for (i=0;i<2;i++) {
        freesolbuf(SolData+i);
        free(SolStat[i].data);
        SolStat[i].n=0;
        SolStat[i].data=NULL;
    }
    freeobs(&Obs);
    freenav(&Nav,0xFF);
    delete [] IndexObs;
    delete [] Az;
    delete [] El;
    IndexObs=NULL;
    Az=NULL;
    El=NULL;
    SolFiles[0]->Clear();
    SolFiles[1]->Clear();
    ObsFiles->Clear();
    NavFiles->Clear();
    NObs=0;
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    
    for (i=0;i<3;i++) {
        TimeEna[i]=0;
    }
    TimeStart=TimeEnd=epoch2time(ep);
    BtnAnimate->Down=false;
    
    if (PlotType>PLOT_NSAT) {
        UpdateType(PLOT_TRK);
    }
    if (!ConnectState) {
        initsolbuf(SolData  ,0,0);
        initsolbuf(SolData+1,0,0);
        Caption=Title!=""?Title:s.sprintf("%s ver.%s",PRGNAME,VER_RTKLIB);
    }
    else {
        initsolbuf(SolData  ,1,RtBuffSize+1);
        initsolbuf(SolData+1,1,RtBuffSize+1);
    }
    UpdateTime();
    UpdatePlot();
}
示例#9
0
LRESULT CMainDlg::OnLoop(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	UpdatePlot();
	double dur = 2.0;
	double frq = GetFrequency();
	if (Play(frq, dur, TRUE) == 0)
	{
		btnStop.EnableWindow(TRUE);
		btnPlay.EnableWindow(FALSE);
		btnLoop.EnableWindow(FALSE);
	}
	return 0;
}
示例#10
0
// read navigation data -----------------------------------------------------
void __fastcall TPlot::ReadNav(TStrings *files)
{
    AnsiString s;
    gtime_t ts,te;
    double tint;
    char navfile[1024],*opt=RnxOpts.c_str();
    int i;
    
    trace(3,"ReadNav\n");
    
    if (files->Count<=0) return;
    
    ReadWaitStart();
    ShowLegend(NULL);
    
    TimeSpan(&ts,&te,&tint);
    
    freenav(&Nav,0xFF);
    
    ShowMsg("reading nav data...");
    Application->ProcessMessages();
    
    for (i=0;i<files->Count;i++) {
        strcpy(navfile,U2A(files->Strings[i]).c_str());
        readrnxt(navfile,1,ts,te,tint,opt,NULL,&Nav,NULL);
    }
    uniqnav(&Nav);
    
    if (Nav.n<=0&&Nav.ng<=0&&Nav.ns<=0) {
        ShowMsg(s.sprintf("no nav message: %s...",files->Strings[0].c_str()));
        ReadWaitEnd();
        return;
    }
    if (NavFiles!=files) {
        NavFiles->Assign(files);
    }
    UpdateObs(NObs);
    UpdateMp();
    ReadWaitEnd();
    
    UpdatePlot();
}
示例#11
0
// clear data ------------------------------------------------------------------
void __fastcall TPlot::Clear(void)
{
    AnsiString s;
    double ep[]={2010,1,1,0,0,0};
    int i;
    
    trace(3,"Clear\n");
    
    Week=0;
    
    ClearObs();
    ClearSol();
    
    for (i=0;i<3;i++) {
        TimeEna[i]=0;
    }
    TimeStart=TimeEnd=epoch2time(ep);
    BtnAnimate->Down=false;
    
    if (PlotType>PLOT_NSAT) {
        UpdateType(PLOT_TRK);
    }
    if (!ConnectState) {
        initsolbuf(SolData  ,0,0);
        initsolbuf(SolData+1,0,0);
        Caption=Title!=""?Title:s.sprintf("%s ver.%s",PRGNAME,VER_RTKLIB);
    }
    else {
        initsolbuf(SolData  ,1,RtBuffSize+1);
        initsolbuf(SolData+1,1,RtBuffSize+1);
    }
    GoogleEarthView->Clear();
    
    UpdateTime();
    UpdatePlot();
}
示例#12
0
// read solutions -----------------------------------------------------------
void __fastcall TPlot::ReadSol(TStrings *files, int sel)
{
    solbuf_t sol={0};
    AnsiString s;
    gtime_t ts,te;
    double tint;
    int i,n=0;
    char *paths[MAXNFILE]={""};
    
    trace(3,"ReadSol: sel=%d\n",sel);
    
    if (files->Count<=0) return;
    
    ReadWaitStart();
    
    for (i=0;i<files->Count&&n<MAXNFILE;i++) {
        paths[n++]=files->Strings[i].c_str();
    }
    TimeSpan(&ts,&te,&tint);
    
    ShowMsg(s.sprintf("reading %s...",paths[0]));
    ShowLegend(NULL);
    
    if (!readsolt(paths,n,ts,te,tint,0,&sol)) {
        ShowMsg(s.sprintf("no solution data : %s...",paths[0]));
        ShowLegend(NULL);
        ReadWaitEnd();
        return;
    }
    freesolbuf(SolData+sel);
    SolData[sel]=sol;
    
    if (SolFiles[sel]!=files) {
        SolFiles[sel]->Assign(files);
    }
    Caption="";
    
    ReadSolStat(files,sel);
    
    for (i=0;i<2;i++) {
        if (SolFiles[i]->Count==0) continue;
        Caption=Caption+SolFiles[i]->Strings[0]+(SolFiles[i]->Count>1?"... ":" ");
    }
    BtnSol12->Down=False;
    if (sel==0) BtnSol1->Down=true;
    else        BtnSol2->Down=true;
    
    if (sel==0||SolData[0].n<=0) {
        time2gpst(SolData[sel].data[0].time,&Week);
        UpdateOrigin();
    }
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    
    if (PlotType>PLOT_NSAT) {
        UpdateType(PLOT_TRK);
    }
    else {
        UpdatePlotType();
    }
    FitTime();
    if (AutoScale&&PlotType<=PLOT_SOLA) {
        FitRange(1);
    }
    else {
        SetRange(1,YRange);
    }
    UpdateTime();
    UpdatePlot();
    
    ReadWaitEnd();
}
示例#13
0
Dlg_Physics::Dlg_Physics(QVX_Sim* pSimIn, QWidget *parent)
	: QWidget(parent)
{
	pSim = pSimIn;
	ui.setupUi(this);

	//these should be in the order of the stop condition enum
	ui.StopSelectCombo->addItem("None");
	ui.StopSelectCombo->addItem("Time Steps");
	ui.StopSelectCombo->addItem("Simulation Time");
	ui.StopSelectCombo->addItem("Temperature cycles");
	ui.StopSelectCombo->addItem("Constant Energy");
	ui.StopSelectCombo->addItem("Kinetic Floor");
	ui.StopSelectCombo->addItem("Motion Floor");

	//these should match the order of the PlotType enum
	ui.VariableCombo->addItem("Displacement");
//	ui.VariableCombo->addItem("Force");
	ui.VariableCombo->addItem("Kinetic Energy");
	ui.VariableCombo->addItem("Potential Energy");
	ui.VariableCombo->addItem("Total Energy");

	//these should match the order of the PlotDir enum
	ui.DirectionCombo->addItem("Maximum");
	ui.DirectionCombo->addItem("X Direction");
	ui.DirectionCombo->addItem("Y Direction");
	ui.DirectionCombo->addItem("Z Direction");

	//enforce type-ins
	const QValidator* DEval = new QDoubleValidator(this);
	ui.dtEdit->setValidator(DEval);

	CurPlotType = PL_DISP;
	CurPlotDir = MAXDIR;

	connect(ui.PauseButton, SIGNAL(clicked()), this, SLOT(ClickedPause()));
	connect(ui.ResetButton, SIGNAL(clicked()), this, SLOT(ClickedReset()));
	connect(ui.RecordButton, SIGNAL(clicked(bool)), this, SLOT(ClickedRecord(bool)));

	
	connect(ui.UseEquilibriumCheck, SIGNAL(clicked(bool)), this, SLOT(UseEquilibriumCheckChanged(bool)));
	connect(ui.StopSelectCombo, SIGNAL(activated(int)), this, SLOT(StopSelectChanged(int)));
	connect(ui.StopValueEdit, SIGNAL(editingFinished()), this, SLOT(StopValueEditChanged()));

	connect(ui.dtSlider, SIGNAL(valueChanged(int)), this, SLOT(dtSliderChanged(int)));
	connect(ui.dtEdit, SIGNAL(editingFinished()), this, SLOT(dtEditChanged()));
	connect(ui.BondDampSlider, SIGNAL(valueChanged(int)), this, SLOT(BondDampSliderChanged(int)));
	connect(ui.BondDampEdit, SIGNAL(editingFinished()), this, SLOT(BondDampEditChanged()));
	connect(ui.GNDDampSlider, SIGNAL(valueChanged(int)), this, SLOT(GNDDampSliderChanged(int)));
	connect(ui.GNDDampEdit, SIGNAL(editingFinished()), this, SLOT(GNDDampEditChanged()));
	connect(ui.ColDampSlider, SIGNAL(valueChanged(int)), this, SLOT(ColDampSliderChanged(int)));
	connect(ui.ColDampEdit, SIGNAL(editingFinished()), this, SLOT(ColDampEditChanged()));
	connect(ui.MaxVelLimitSlider, SIGNAL(valueChanged(int)), this, SLOT(MaxVelLimitSliderChanged(int)));
	connect(ui.UseSelfColCheck, SIGNAL(clicked(bool)), this, SLOT(UseSelfColCheckChanged(bool)));
	connect(ui.UseMaxVelLimitCheck, SIGNAL(clicked(bool)), this, SLOT(UseMaxVelLimitCheckChanged(bool)));


	connect(ui.UseTempCheck, SIGNAL(clicked(bool)), this, SLOT(UseTempCheckChanged(bool)));
	connect(ui.TempSlider, SIGNAL(valueChanged(int)), this, SLOT(TempSliderChanged(int)));
	connect(ui.TempEdit, SIGNAL(editingFinished()), this, SLOT(TempEditChanged()));
	connect(ui.Temp2Slider, SIGNAL(valueChanged(int)), this, SLOT(Temp2SliderChanged(int)));
	connect(ui.Temp2Edit, SIGNAL(editingFinished()), this, SLOT(Temp2EditChanged()));
	connect(ui.VaryTempCheck, SIGNAL(clicked(bool)), this, SLOT(VaryTempCheckChanged(bool)));
	connect(ui.TempPerSlider, SIGNAL(valueChanged(int)), this, SLOT(TempPerSliderChanged(int)));
	connect(ui.TempPerEdit, SIGNAL(editingFinished()), this, SLOT(TempPerEditChanged()));
	//connect(ui.TempPerEdit, SIGNAL(textChanged(QString)), this, SLOT(TempPerEditTextChanged(QString)));
	connect(ui.UseGravCheck, SIGNAL(clicked(bool)), this, SLOT(UseGravCheckChanged(bool)));
	connect(ui.GravSlider, SIGNAL(valueChanged(int)), this, SLOT(GravSliderChanged(int)));
	connect(ui.GravEdit, SIGNAL(editingFinished()), this, SLOT(GravEditChanged()));

	connect(ui.UseFloorCheck, SIGNAL(clicked(bool)), this, SLOT(UseFloorCheckChanged(bool)));

	connect(ui.DispDisableRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayDisableChanged(bool)));
	connect(ui.DispVoxelsRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayVoxChanged(bool)));
	connect(ui.DispConnRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayConChanged(bool)));


	connect(ui.ViewDiscreteRadio, SIGNAL(clicked(bool)), this, SLOT(VoxDiscreteChanged(bool)));
	connect(ui.ViewDeformedRadio, SIGNAL(clicked(bool)), this, SLOT(VoxDeformedChanged(bool)));
	connect(ui.ViewSmoothRadio, SIGNAL(clicked(bool)), this, SLOT(VoxSmoothChanged(bool)));
//	connect(ui.BondsCheck, SIGNAL(clicked(bool)), this, SLOT(BondsCheckChanged(bool)));
	connect(ui.ForcesCheck, SIGNAL(clicked(bool)), this, SLOT(ForcesCheckChanged(bool)));
	connect(ui.LocalCoordCheck, SIGNAL(clicked(bool)), this, SLOT(LCsCheckChanged(bool)));

	connect(ui.TypeRadio, SIGNAL(clicked(bool)), this, SLOT(CTypeChanged(bool)));
	connect(ui.KineticERadio, SIGNAL(clicked(bool)), this, SLOT(CKinEChanged(bool)));
	connect(ui.DisplacementRadio, SIGNAL(clicked(bool)), this, SLOT(CDispChanged(bool)));
	connect(ui.StateRadio, SIGNAL(clicked(bool)), this, SLOT(CStateChanged(bool)));
	connect(ui.StrainERadio, SIGNAL(clicked(bool)), this, SLOT(CStrainEChanged(bool)));
	connect(ui.StrainRadio, SIGNAL(clicked(bool)), this, SLOT(CStrainChanged(bool)));
	connect(ui.StressRadio, SIGNAL(clicked(bool)), this, SLOT(CStressChanged(bool)));

	connect(ui.CoMCheck, SIGNAL(clicked(bool)), this, SLOT(CmMCheckChanged(bool)));
//	connect(ui.BbCheck, SIGNAL(clicked(bool)), this, SLOT(BbCheckChanged(bool)));

	connect(ui.VariableCombo, SIGNAL(activated(int)), this, SLOT(VarComboChanged(int)));
	connect(ui.DirectionCombo, SIGNAL(activated(int)), this, SLOT(DirComboChanged(int)));
	connect(ui.LogEachCheck, SIGNAL(clicked(bool)), this, SLOT(LogEachCheckChanged(bool)));
	connect(ui.SaveDataButton, SIGNAL(clicked()), this, SLOT(ClickedSaveData()));

	//set up plot for real-time display...
//	d_directPainter = new QwtPlotDirectPainter(ui.DataPlot);
	d_data = NULL;
	d_curve = NULL;

	ui.DataPlot->setAxisMaxMinor(QwtPlot::xBottom, 1);
	ui.DataPlot->setAxisMaxMinor(QwtPlot::yLeft, 1);
//	ui.DataPlot->setAutoReplot(false);
	/*


	d_curve = new QwtPlotCurve("MyData");
	
	double x[3] = {0};
	double y[3] = {0};
	x[1] = 1;
	x[2] = 2;
	y[1] = 1;

	d_curve->attach(ui.DataPlot);
	d_curve->setSamples(x, y, 3);
	ui.DataPlot->setAxisMaxMinor(QwtPlot::xBottom, 1);
	ui.DataPlot->setAxisMaxMinor(QwtPlot::yLeft, 1);
	//ui.DataPlot->setMargin(0);
	//ui.DataPlot->plotLayout()->setMargin(0);
	//ui.DataPlot->plotLayout()->setSpacing(0);
*/

//	ui.DataPlot->
	PlotUpdateTimer = new QTimer(this);
	connect(PlotUpdateTimer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));

	PlotUpdateRate = 33;
	PlotUpdateTimer->start(PlotUpdateRate); //just run continuously...

	TimestepMag = 1.0;

	UpdateUI();
	

}
示例#14
0
// generate visibility data ----------------------------------------------------
void __fastcall TPlot::GenVisData(void)
{
    gtime_t time,ts,te;
    obsd_t data={{0}};
    sta_t sta={0};
    double tint,r,pos[3],rr[3],rs[6],e[3],azel[2];
    int i,j,nobs=0;
    char name[16];
    
    trace(3,"GenVisData\n");
    
    ClearObs();
    SimObs=1;
    
    ts=TimeStart;
    te=TimeEnd;
    tint=TimeInt;
    matcpy(pos,OOPos,3,1);
    pos2ecef(pos,rr);
    
    ReadWaitStart();
    ShowLegend(NULL);
    ShowMsg("generating satellite visibility...");
    Application->ProcessMessages();
    
    for (time=ts;timediff(time,te)<=0.0;time=timeadd(time,tint)) {
        for (i=0;i<MAXSAT;i++) {
            satno2id(i+1,name);
            if (!tle_pos(time,name,"","",&TLEData,NULL,rs)) continue;
            if ((r=geodist(rs,rr,e))<=0.0) continue;
            if (satazel(pos,e,azel)<=0.0) continue;
            if (Obs.n>=Obs.nmax) {
                Obs.nmax=Obs.nmax<=0?4096:Obs.nmax*2;
                Obs.data=(obsd_t *)realloc(Obs.data,sizeof(obsd_t)*Obs.nmax);
                if (!Obs.data) {
                    Obs.n=Obs.nmax=0;
                    break;
                }
            }
            data.time=time;
            data.sat=i+1;
            
            for (j=0;j<NFREQ;j++) {
                data.P[j]=data.L[j]=0.0;
                data.code[j]=CODE_NONE;
            }
            data.code[0]=CODE_L1C;
            Obs.data[Obs.n++]=data;
        }
        if (++nobs>=MAX_SIMOBS) break;
    }
    if (Obs.n<=0) {
        ReadWaitEnd();
        ShowMsg("no satellite visibility");
        return;
    }
    UpdateObs(nobs);
    
    Caption="Satellite Visibility (Predicted)";
    BtnSol1->Down=true;
    time2gpst(Obs.data[0].time,&Week);
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    if (PlotType<PLOT_OBS||PLOT_DOP<PlotType) {
        UpdateType(PLOT_OBS);
    }
    else {
        UpdatePlotType();
    }
    FitTime();
    ReadWaitEnd();
    UpdateObsType();
    UpdateTime();
    UpdatePlot();
}
示例#15
0
LRESULT CMainDlg::OnRefresh(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	UpdatePlot();
	return 0;
}
示例#16
0
int main(int argc, char *argv[])
{

    i=0.0;
    numPlotPoints=0;

    //Allocate memory for the plot
    plot = (DATA_POINT**)calloc( MAX_PLOTS, sizeof(DATA_POINT*));

#ifdef seawolf
    Seawolf_loadConfig("../../conf/seawolf.conf");
    Seawolf_init("HUD");
#endif

    currentDepth=0;

    dpy = XOpenDisplay(NULL);

    if(dpy == NULL)
        {
            printf("\n\tcannot connect to X server\n\n");
            exit(0);
        }

    root = DefaultRootWindow(dpy);

    vi = glXChooseVisual(dpy, 0, att);

    if(vi == NULL)
        {
            printf("\n\tno appropriate visual found\n\n");
            exit(0);
        }
    else
        {
            //printf("\n\tvisual %p selected\n", vi->visualid);
        }/* %p creates hexadecimal output like in glxinfo */


    cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);

    swa.colormap = cmap;
    swa.event_mask = ExposureMask | KeyPressMask;

    win = XCreateWindow(dpy, root, (SCREEN_X-WINDOW_X)/2,(SCREEN_Y-WINDOW_Y)/2 , WINDOW_X, WINDOW_Y, 0, vi->depth, InputOutput, vi->visual, CWColormap | CWEventMask, &swa);

    XMapWindow(dpy, win);
    XStoreName(dpy, win, "Seawolf HUD");

    glc = glXCreateContext(dpy, vi, NULL, GL_TRUE);
    glXMakeCurrent(dpy, win, glc);

    glEnable(GL_DEPTH_TEST);

#ifdef seawolf
    Var_bind("Depth", &currentDepth);
    Var_bind("DepthPID.Heading", &desiredDepth);
    Var_bind("SEA.Roll", &currentRoll);
    Var_bind("SEA.Pitch", &currentPitch);
    Var_bind("SEA.Yaw", &currentYaw);
#endif

    while(1)
        {

#ifdef seawolf
            Util_usleep(0.02);
#else
            currentDepth=10.0*sin(i*PI/180.0);
            currentRoll =180.0*cos(i*PI/180.0) ;
            currentPitch=10.0*sin(i*PI/180.0);
            currentYaw = 180.0*cos((i+90.0)*PI/180.0);

            desiredDepth=4*cos(i*PI/180.0);
            desiredPitch=180.0*sin((i+30.0f)*PI/180.0);
            desiredYaw = 180.0*cos((i+90.0)*PI/180.0);
#endif


            //Initialize the plots you want to see
            UpdatePlot(CUR_DEPTH, currentDepth);
            UpdatePlot(SET_DEPTH, desiredDepth);
            UpdatePlot(CUR_ROLL, currentRoll);
            UpdatePlot(SET_ROLL, desiredDepth);
            UpdatePlot(CUR_PITCH, currentPitch);
            UpdatePlot(SET_PITCH, desiredPitch);
            UpdatePlot(CUR_YAW, currentYaw);
            UpdatePlot(SET_YAW, desiredYaw);
            //Incriment the number of points in the buffer
            numPlotPoints++;

            i+=0.1;

            XGetWindowAttributes(dpy, win, &gwa);
            //glViewport(0, 0, gwa.width, gwa.height);
            glViewport(0,0, WINDOW_X, WINDOW_Y);
            Render();
            glXSwapBuffers(dpy, win);

        }
}
Dlg_Physics::Dlg_Physics(QVX_Sim* pSimIn, QWidget *parent)
	: QWidget(parent)
{
	pSim = pSimIn;
	ui.setupUi(this);

	//these should be in the order of the stop condition enum
	ui.StopSelectCombo->addItem("None");
	ui.StopSelectCombo->addItem("Time Steps");
	ui.StopSelectCombo->addItem("Simulation Time");
	ui.StopSelectCombo->addItem("Temperature cycles");
	ui.StopSelectCombo->addItem("Constant Energy");
	ui.StopSelectCombo->addItem("Kinetic Floor");
	ui.StopSelectCombo->addItem("Motion Floor");

	//these should match the order of the PlotType enum
	ui.VariableCombo->addItem("Displacement");
	ui.VariableCombo->addItem("Angle");
	ui.VariableCombo->addItem("Kinetic Energy");
	ui.VariableCombo->addItem("Potential Energy");
	ui.VariableCombo->addItem("Total Energy");
	ui.VariableCombo->addItem("Max Voxel Movement");


	//these should match the order of the PlotDir enum
	ui.DirectionCombo->addItem("Maximum");
	ui.DirectionCombo->addItem("X Direction");
	ui.DirectionCombo->addItem("Y Direction");
	ui.DirectionCombo->addItem("Z Direction");

	//enforce type-ins
	const QValidator* DEval = new QDoubleValidator(this);
	ui.dtEdit->setValidator(DEval);

	CurPlotType = PL_DISP;
	CurPlotDir = MAXDIR;

	connect(ui.PauseButton, SIGNAL(clicked()), this, SLOT(ClickedPause()));
	connect(ui.ResetButton, SIGNAL(clicked()), this, SLOT(ClickedReset()));
	connect(ui.RecordButton, SIGNAL(clicked(bool)), this, SLOT(ClickedRecord(bool)));

	
	connect(ui.UseEquilibriumCheck, SIGNAL(clicked(bool)), this, SLOT(UseEquilibriumCheckChanged(bool)));
	connect(ui.StopSelectCombo, SIGNAL(activated(int)), this, SLOT(StopSelectChanged(int)));
	connect(ui.StopValueEdit, SIGNAL(editingFinished()), this, SLOT(StopValueEditChanged()));

	connect(ui.dtSlider, SIGNAL(valueChanged(int)), this, SLOT(dtSliderChanged(int)));
	connect(ui.dtEdit, SIGNAL(editingFinished()), this, SLOT(dtEditChanged()));
	connect(ui.BondDampSlider, SIGNAL(valueChanged(int)), this, SLOT(BondDampSliderChanged(int)));
	connect(ui.BondDampEdit, SIGNAL(editingFinished()), this, SLOT(BondDampEditChanged()));
	connect(ui.GNDDampSlider, SIGNAL(valueChanged(int)), this, SLOT(GNDDampSliderChanged(int)));
	connect(ui.GNDDampEdit, SIGNAL(editingFinished()), this, SLOT(GNDDampEditChanged()));
	connect(ui.ColDampSlider, SIGNAL(valueChanged(int)), this, SLOT(ColDampSliderChanged(int)));
	connect(ui.ColDampEdit, SIGNAL(editingFinished()), this, SLOT(ColDampEditChanged()));
	connect(ui.MaxVelLimitSlider, SIGNAL(valueChanged(int)), this, SLOT(MaxVelLimitSliderChanged(int)));
	connect(ui.UseSelfColCheck, SIGNAL(clicked(bool)), this, SLOT(UseSelfColCheckChanged(bool)));
	connect(ui.UseMaxVelLimitCheck, SIGNAL(clicked(bool)), this, SLOT(UseMaxVelLimitCheckChanged(bool)));

	connect(ui.UseVolumeEffectsCheck, SIGNAL(clicked(bool)), this, SLOT(UseVolEffectsCheckChanged(bool)));

	connect(ui.UseTempCheck, SIGNAL(clicked(bool)), this, SLOT(UseTempCheckChanged(bool)));
	connect(ui.TempSlider, SIGNAL(valueChanged(int)), this, SLOT(TempSliderChanged(int)));
	connect(ui.TempEdit, SIGNAL(editingFinished()), this, SLOT(TempEditChanged()));
	connect(ui.VaryTempCheck, SIGNAL(clicked(bool)), this, SLOT(VaryTempCheckChanged(bool)));
	connect(ui.TempPerSlider, SIGNAL(valueChanged(int)), this, SLOT(TempPerSliderChanged(int)));
	connect(ui.TempPerEdit, SIGNAL(editingFinished()), this, SLOT(TempPerEditChanged()));
	connect(ui.UseGravCheck, SIGNAL(clicked(bool)), this, SLOT(UseGravCheckChanged(bool)));
	connect(ui.GravSlider, SIGNAL(valueChanged(int)), this, SLOT(GravSliderChanged(int)));
	connect(ui.GravEdit, SIGNAL(editingFinished()), this, SLOT(GravEditChanged()));

	connect(ui.UseFloorCheck, SIGNAL(clicked(bool)), this, SLOT(UseFloorCheckChanged(bool)));

	connect(ui.DispDisableRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayDisableChanged(bool)));
	connect(ui.DispVoxelsRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayVoxChanged(bool)));
	connect(ui.DispConnRadio, SIGNAL(clicked(bool)), this, SLOT(DisplayConChanged(bool)));


	connect(ui.ViewDiscreteRadio, SIGNAL(clicked(bool)), this, SLOT(VoxDiscreteChanged(bool)));
	connect(ui.ViewDeformedRadio, SIGNAL(clicked(bool)), this, SLOT(VoxDeformedChanged(bool)));
	connect(ui.ViewSmoothRadio, SIGNAL(clicked(bool)), this, SLOT(VoxSmoothChanged(bool)));
	connect(ui.ForcesCheck, SIGNAL(clicked(bool)), this, SLOT(ForcesCheckChanged(bool)));
	connect(ui.LocalCoordCheck, SIGNAL(clicked(bool)), this, SLOT(LCsCheckChanged(bool)));

	connect(ui.TypeRadio, SIGNAL(clicked(bool)), this, SLOT(CTypeChanged(bool)));
	connect(ui.KineticERadio, SIGNAL(clicked(bool)), this, SLOT(CKinEChanged(bool)));
	connect(ui.DisplacementRadio, SIGNAL(clicked(bool)), this, SLOT(CDispChanged(bool)));
	connect(ui.StateRadio, SIGNAL(clicked(bool)), this, SLOT(CStateChanged(bool)));
	connect(ui.StrainERadio, SIGNAL(clicked(bool)), this, SLOT(CStrainEChanged(bool)));
	connect(ui.StrainRadio, SIGNAL(clicked(bool)), this, SLOT(CStrainChanged(bool)));
	connect(ui.StressRadio, SIGNAL(clicked(bool)), this, SLOT(CStressChanged(bool)));
	connect(ui.PressureRadio, SIGNAL(clicked(bool)), this, SLOT(CPressureChanged(bool)));

	connect(ui.CoMCheck, SIGNAL(clicked(bool)), this, SLOT(CoMCheckChanged(bool)));


	connect(ui.VariableCombo, SIGNAL(activated(int)), this, SLOT(VarComboChanged(int)));
	connect(ui.DirectionCombo, SIGNAL(activated(int)), this, SLOT(DirComboChanged(int)));
	connect(ui.LogEachCheck, SIGNAL(clicked(bool)), this, SLOT(LogEachCheckChanged(bool)));
	connect(ui.SaveDataButton, SIGNAL(clicked()), this, SLOT(ClickedSaveData()));

	//set up plot for real-time display...
	
	pPlot = new QSimplePlot();
	ui.verticalLayout_3->insertWidget(1, pPlot);
	pPlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

	PlotUpdateTimer = new QTimer(this);
	connect(PlotUpdateTimer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));

	PlotUpdateRate = 33;
	PlotUpdateTimer->start(PlotUpdateRate); //just run continuously...

	UpdateUI();
	
}