/usr/include/terralib/kernel/TeProxMatrixWeightsStrategy.h is in libterralib-dev 4.0.0-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /************************************************************************************
TerraLib - a library for developing GIS applications.
Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
This code is part of the TerraLib library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public
License along with this library.
The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The library provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this library and its documentation.
*************************************************************************************/
/*! \file TeProxMatrixWeightsStrategy.h
\brief This file contains structures and definitions about weight strategies of proximity matrix
*/
#ifndef TeProxMatrixWeightsStrategy_H
#define TeProxMatrixWeightsStrategy_H
#include "TeProxMatrixImplementation.h"
#include <vector>
struct TL_DLL TeProxMatrixWeightsParams
{
public:
TeGPMWeightsStrategy strategy_;
bool norm_;
double a_;
double b_;
double c_;
double factor_;
double dist_ratio_;
double max_local_dist_;
TeProxMatrixWeightsParams():
strategy_(TeNoWeightsStrategy), norm_(false), a_(1.),
b_(1.), c_(1.), factor_(1.), dist_ratio_(0.), max_local_dist_(0.)
{}
TeProxMatrixWeightsParams(bool norm, const TeGPMWeightsStrategy& type):
strategy_(type), norm_(norm), a_(1.), b_(1.), c_(1.),
factor_(1.), dist_ratio_(0.), max_local_dist_(0.)
{}
bool operator== (const TeProxMatrixWeightsParams& other) const
{
return ((strategy_==other.strategy_) && (norm_==other.norm_) &&
(a_==other.a_) && (b_==other.b_) && (c_==other.c_) &&
(factor_==other.factor_) && (dist_ratio_==other.dist_ratio_) &&
(max_local_dist_==other.max_local_dist_));
}
};
//! An abstract class to representate weight strategies of proximity matrix
class TL_DLL TeProxMatrixWeightsStrategy
{
protected:
TeProxMatrixWeightsParams params_;
//! Constructor
TeProxMatrixWeightsStrategy(bool norm = false, const TeGPMWeightsStrategy& type=TeNoWeightsStrategy ):
params_(norm, type)
{ }
public:
//! Compute weigths
virtual bool ComputeWeigths (TeProxMatrixImplementation* ) =0;
//! Destructor
virtual ~TeProxMatrixWeightsStrategy() {}
//! Equal operator
virtual bool operator== (const TeProxMatrixWeightsStrategy& w) const {return (params_==w.params_);}
//! Returns the strategy to weigt the matrix
TeProxMatrixWeightsParams& weightsParams() { return params_; }
};
//! A class to implement the no weight strategy of proximity matrix (i.e., all weights are 1, only indicating that a connection exists).
class TL_DLL TeProxMatrixNoWeightsStrategy : public TeProxMatrixWeightsStrategy
{
public:
//! Constructor
TeProxMatrixNoWeightsStrategy (bool norm = true) : TeProxMatrixWeightsStrategy(norm, TeNoWeightsStrategy)
{ }
//! Compute weigths
virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
//! Destructor
~TeProxMatrixNoWeightsStrategy() {}
};
//! A class to implement the inverse distance weight strategy of proximity matrix; if network distances were computed, they can be also considered.
//! Formula: w = (a*1/dist_centroids + b*1/dist_to_net + c*1/dist_net_connection)*factor
//! These values can be normalized or not.
class TL_DLL TeProxMatrixInverseDistanceStrategy : public TeProxMatrixWeightsStrategy
{
public:
//! Constructor
TeProxMatrixInverseDistanceStrategy (double a = 1.0, double b = 1.0, double c = 1.0, double factor = 1.0, bool norm = true) :
TeProxMatrixWeightsStrategy (norm, TeInverseDistanceStrategy)
{ params_.a_ = a; params_.b_ = b; params_.c_ = c; params_.factor_ = factor;}
//! Compute weights
virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
//! Destructor
~TeProxMatrixInverseDistanceStrategy() {}
};
//! A class to implement the inverse distance weight strategy of proximity matrix; if network distances were computed, they can be also considered.
//! Formula: w = (a*1/(dist_centroids)2 + b*1/(dist_to_net)2 + c*1/(dist_net_connection)2)*factor
//! These values can be normalized or not.
class TL_DLL TeProxMatrixSquaredInverseDistanceStrategy : public TeProxMatrixWeightsStrategy
{
public:
//! Constructor
TeProxMatrixSquaredInverseDistanceStrategy (double a = 1.0, double b = 1.0, double c = 1.0, double factor = 1.0, bool norm = true) :
TeProxMatrixWeightsStrategy (norm, TeSquaredInverseDistStrategy)
{ params_.a_ = a; params_.b_ = b; params_.c_ = c; params_.factor_ = factor;}
//! Compute weights
virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
//! Destructor
~TeProxMatrixSquaredInverseDistanceStrategy() {}
};
//! A class to implement the connection strenght weight strategy of proximity matrix
//! If centroids distance is smaller them max_local_distance, w will be only the local distance inverse (multiplied by factor).
//! otherwise, it will be w = 1/(dist_ratio*dist_to_net + dist_net_connection)*factor.
class TL_DLL TeProxMatrixConnectionStrenghtStrategy : public TeProxMatrixWeightsStrategy
{
public:
//! Constructor
TeProxMatrixConnectionStrenghtStrategy (double dist_ratio = 1.0, double max_local_distance = 0.0, double factor = 1.0, bool norm = true)
: TeProxMatrixWeightsStrategy (norm, TeConnectionStrenghtStrategy )
{
params_.dist_ratio_ = dist_ratio;
params_.max_local_dist_ = max_local_distance;
params_.factor_ = factor;
}
//! Compute weights
virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
//! Destructor
~TeProxMatrixConnectionStrenghtStrategy() {}
};
#endif
|