VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Importing/Exporting Scenarios from Different File Formats (csvScenarioImporterExporterSim)

The Importing/Exporting Scenarios from Different File Formats example demonstrates the following:

The Importing/Exporting scenarios example installes a new scenario importer/exporter that will read a comma delimited file and restore entity/aggregate laydown as well as tactical graphic objects.

Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application. Make sure to enable the csvScenarioImporterExporter example from the launcher application

Usage

In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin. Then launch VR-Forces.

To view the new behavior:

  1. Load Scenario...
  2. Export Scenario... selecting CSV format
  3. New Scenario...
  4. Import Scenario... selecting file just exported to verify that objects were exported correctly

Notes

Scenario Import/Export does not export VR Forces specific data, such as Plans and Tasks.

Classes

DtVrfCSVScenarioDescriptionImporterExporterClass that will import/export information to/from the scenario. Extension of DtCSVScenarioDescriptionImporterExporter.
DtCSVScenarioDescriptionImporterExporterClass that will fill in internal structures with information from a comma delimited file or write the comma delimited file from scenario information.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//VR-Forces includes
#include "vrfcgf/cgf.h"
extern "C" {
{
info.pluginName = "csvScenarioImporterExporterSim";
info.pluginDescription = "An example of how to take a scenario imported from a file and incorporate it into an existing scenario";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "150 Cambridge Park Drive 3rd Floor - Cambridge, MA 02140 USA";
info.pluginContactPhone = "(617) 876 8085";
}
DT_VRF_DLL_PLUGIN bool DtPostInitializeVrfPlugin(DtCgf* cgf)
{
return true;
}
}

Header

/*******************************************************************************
** Copyright (c) 2012 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#pragma once
{
public:
virtual void importScenario(const DtFilename&);
virtual void exportScenario(const DtFilename&);
virtual std::string supportedExtensions();
virtual bool canImportFile(const DtFilename&);
};

Class

/*******************************************************************************
** Copyright (c) 2012 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include "../csvScenarioImporterExporterSim/csvScenarioDescriptionImporterExporter.h"
#include <vrvCore/DtDe.h>
using namespace makVrv;
using namespace makVrf;
{
}
{
}
{
std::map<std::string, std::string> importData;
DtGuiThreadVrfRemoteController::instance(myDe).importScenarioDescriptionFile(file.c_str(),
DtVrfSimBackendManager::instance(myDe).selectedBackend(), "csv", importData);
}
{
std::map<std::string, std::string> exportData;
DtGuiThreadVrfRemoteController::instance(myDe).exportScenarioDescriptionFile(file.c_str(),
DtVrfSimBackendManager::instance(myDe).selectedBackend(), "csv", exportData);
}
{
std::string supported = imp->supportedExtensions();
delete imp;
return supported;
}
{
bool canImport = imp->canImportFile(f);
delete imp;
return canImport;
}
{
}

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)