2021-06-21 14:26:09 +02:00
|
|
|
//=-------------------------------------------------------------------------=//
|
|
|
|
// Model management module //
|
|
|
|
// //
|
|
|
|
// Copyright © 2021 The Gem-graph Project //
|
|
|
|
// //
|
|
|
|
// This file is part of gem-graph. //
|
|
|
|
// //
|
|
|
|
// This program is free software: you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU Affero General Public License as //
|
|
|
|
// published by the Free Software Foundation, either version 3 of the //
|
|
|
|
// License, or (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU Affero General Public License for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU Affero General Public License //
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
|
|
|
//=-------------------------------------------------------------------------=//
|
|
|
|
|
|
|
|
#include "../include/base.h"
|
2021-06-23 09:13:46 +02:00
|
|
|
#include "../include/arrows.h"
|
|
|
|
|
|
|
|
static Model_t *loadedModels;
|
2021-06-21 14:26:09 +02:00
|
|
|
|
|
|
|
void ModelPrepareSpace(Space_t *globalDrawingSpace, Model_t *model)
|
|
|
|
{
|
|
|
|
globalDrawingSpace->size = (model->space_xmax+1) * (model->space_ymax+1) * (model->space_zmax+1);
|
|
|
|
globalDrawingSpace->xmax = model->space_xmax;
|
|
|
|
globalDrawingSpace->ymax = model->space_ymax;
|
|
|
|
globalDrawingSpace->zmax = model->space_zmax;
|
|
|
|
|
|
|
|
globalDrawingSpace->space =
|
|
|
|
(SpaceUnit_t*) calloc(globalDrawingSpace->size, sizeof(SpaceUnit_t));
|
|
|
|
|
|
|
|
for (int i = 0; i < globalDrawingSpace->size; i++) {
|
|
|
|
globalDrawingSpace->space[i].nsite = model->siteNumber;
|
|
|
|
globalDrawingSpace->space[i].sites = (Site_t*) calloc(model->siteNumber, sizeof(Site_t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-23 09:13:46 +02:00
|
|
|
void ModelPrepareArrows(Space_t *globalDrawingSpace, ArrowArray_t *arrowArray,
|
2021-06-21 14:26:09 +02:00
|
|
|
Model_t *model)
|
|
|
|
{
|
2021-06-23 09:13:46 +02:00
|
|
|
arrowArray->array = (Arrow_t*) calloc(6, sizeof(Arrow_t));
|
|
|
|
arrowArray->size = 6;
|
2021-06-21 14:26:09 +02:00
|
|
|
|
|
|
|
// Creating some arrows
|
|
|
|
globalDrawingSpace->space[3].sites[1].narrow = 1;
|
2021-06-23 09:13:46 +02:00
|
|
|
arrowArray->array[0].siteId = 1;
|
|
|
|
arrowArray->array[0].x = 3;
|
2021-06-21 14:26:09 +02:00
|
|
|
|
|
|
|
globalDrawingSpace->space[4].sites[0].narrow = 1;
|
2021-06-23 09:13:46 +02:00
|
|
|
arrowArray->array[1].siteId = 0;
|
|
|
|
arrowArray->array[1].x = 4;
|
2021-06-21 14:26:09 +02:00
|
|
|
}
|