//----------------------------------------------------------------------------------------------- public void PerformOperation(MapOperation operation, WorkingMap workingMap) { if (operation.OpType == eInfluenceOpType.INFLUENCE_OP_NORMALIZE) { workingMap.Normalize(); return; } string operandMapID = operation.InfluenceID; string operandObjectTag = operation.ObjectTag; BaseMap operandMap = InfluenceSystem.GetInstance().GetInfluenceMapByIDWithTag(operandMapID, operandObjectTag); switch (operation.OpType) { case eInfluenceOpType.INFLUENCE_OP_ADD: { workingMap.AddMap(operandMap, operation.Weight); break; } case eInfluenceOpType.INFLUENCE_OP_ADD_INVERSE: { workingMap.AddMapInverse(operandMap, operation.Weight); break; } case eInfluenceOpType.INFLUENCE_OP_MULTIPLY: { workingMap.MultiplyMap(operandMap, operation.Weight); break; } } }
//----------------------------------------------------------------------------------------------- public WorkingMap ConstructMapFromFormula() { WorkingMap workingMap = new WorkingMap(); foreach (MapOperation operation in m_operationInstructions) { PerformOperation(operation, workingMap); } return(workingMap); }
//----------------------------------------------------------------------------------------------- public WorkingMap CreateMapWithFormula(string formulaID) { MapFormula formulaToCreate = GetMapFormulaByID(formulaID); if (formulaToCreate == null) { throw new ArgumentNullException("Formula: " + formulaID); } WorkingMap result = formulaToCreate.ConstructMapFromFormula(); return(result); }
//----------------------------------------------------------------------------------------------- public InfluenceMapPoint GetPointOfHighestInfluenceForMap(string mapFormulaID) { WorkingMap mapResult = CreateMapWithFormula(mapFormulaID); return(mapResult.GetPointOfHighestInfluence()); }